在 Laravel 上使用 Sail 时没有匹配清单错误 [英] No Matching Manifest Error when using Sail on Laravel

查看:31
本文介绍了在 Laravel 上使用 Sail 时没有匹配清单错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Laravel Sail 在 Laravel 中设置一个基本项目.根据 官方 Laravel 文档,以下命令将创建一个名为example-app"的新 Laravel 应用程序并启动 Laravel Sail.

I am attempting to setup a basic project in Laravel using Laravel Sail. According to the official Laravel documentation the following commands will create a new Laravel application called "example-app" and start Laravel Sail.

curl -s "https://laravel.build/example-app" | bash
cd example-app
./vendor/bin/sail up

但是,在运行这些命令后,我看到以下错误消息:

However, after running these commands I see the following error message:

ERROR: no matching manifest for linux/arm64/v8 in the manifest list entries

推荐答案

在带有 Apple M1 芯片的 Mac 上使用 Laravel Sail 时会出现此错误.Laravel Sail 提供的 docker-compose 文件默认使用 MySQL.按照配置,docker-compose 文件正在尝试使用未知版本的 MySQL (linux/arm64/v8).失败并显示上述错误消息.

This error occurs when using Laravel Sail on Macs with the Apple M1 chip. The docker-compose file provided by Laravel Sail uses MySQL by default. As configured, the docker-compose file is attempting to use an unknown version of MySQL (linux/arm64/v8). This fails with the error message above.

打开Laravel项目根目录下的docker-compose.yml文件,搜索mysql部分,在image:

This can be solved by opening the docker-compose.yml file in the Laravel project root folder, searching the section named mysql and adding the following below the image: line

platform: 'linux/amd64'

添加此行将在 Mac M1 上模拟运行 Intel 映像.您可以在官方 关于 Apple Silicon 的 Docker 文档这里.

Adding this line will run an Intel image under emulation on the Mac M1. You can read some background information about this in the official Docker document about Apple Silicon and here.

如果您的用例可能,这也可以通过将图像切换到 MariaDB 而不是 MySQL 来解决.MariaDB 基本上与 MySQL 二进制兼容.如果可能,使用 MariaDB 可能是更好的选择,因为正如 Docker 文档中所述

If possible for your use case this can also be resolved by switching the image to MariaDB instead of MySQL. MariaDB is basically binary compatible with MySQL. Using MariaDB may be a better option if possible because, as mentioned in the Docker document

尝试在 Apple Silicon 机器上运行基于 Intel 的容器仿真可能会崩溃,因为 qemu 有时无法运行容器.

Attempts to run Intel-based containers on Apple Silicon machines under emulation can crash as qemu sometimes fails to run the container.

在 M1 Mac 上模拟使用 MySQL 容器可能会导致启动 Sail 时出现分段错误等问题 - 事实上,我曾在一个案例中看到过这个问题.切换到 MariaDB 解决了这个问题.您可以通过将 docker-compose.yml 文件中 mysql 服务的 image: 行更改为:

Using the MySQL container in emulation on an M1 Mac could cause issues such as a segmentation fault when starting Sail - in fact I saw this issue in one case. Switching to MariaDB resolved this. You can switch Laravel Sail to MariaDB instead of MySQL by changing the image: line for the mysql service in the docker-compose.yml file to:

图片:'mariadb'

这篇关于在 Laravel 上使用 Sail 时没有匹配清单错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆