Laravel Sails 服务 'laravel.test' 构建失败
Laravel Sails Service 'laravel.test' failed to build
我在让 Laravel Sail 处理新的 laravel 8
项目时遇到问题,我在 Ubuntu 20.04 LTS
上,我按照 Ubuntu 20.04 LTS
上的说明进行操作=21=]
到目前为止我所做的是:
首先我创建了一个新的 Laravel 项目:
composer create-project --prefer-dist laravel/laravel blog
然后安装sails :
composer require laravel/sail --dev
已发布的风帆 docker-compose.yml
:
php artisan sail:install
终于起航了:
./vendor/bin/sail up
但是我收到了这个错误:
ERROR: Service 'laravel.test' failed to build
这是完整的错误信息:
Pulling mysql (mysql/mysql-server:8.0)...
8.0: Pulling from mysql/mysql-server
639d1bdfca05: Pull complete
9e100c7b198d: Pull complete
427d2cdb963c: Pull complete
4436dc023066: Pull complete
5800f7888dd1: Pull complete
798cd8b6d3ec: Pull complete
c5ce8d5cf40e: Pull complete
Digest: sha256:91170bd4e012f0bf46b5141a38b612427b37692e8465cdffe9b0ca2d74d37d8a
Status: Downloaded newer image for mysql/mysql-server:8.0
Building laravel.test
Step 1/18 : FROM ubuntu:21.04
21.04: Pulling from library/ubuntu
9e6a0d5477cf: Pull complete
Digest: sha256:93a94c12448f393522f44d8a1b34936b7f76890adea34b80b87a245524d1d574
Status: Downloaded newer image for ubuntu:21.04
---> d662230a2592
Step 2/18 : LABEL maintainer="Taylor Otwell"
---> Running in 89940512e780
Removing intermediate container 89940512e780
---> 2b6050bc73a0
Step 3/18 : ARG WWWGROUP
---> Running in c33ba5cd161c
Removing intermediate container c33ba5cd161c
---> cd665779f65a
Step 4/18 : ARG NODE_VERSION=16
---> Running in 1fab74b70fc7
Removing intermediate container 1fab74b70fc7
---> 9fc2b36920f3
Step 5/18 : WORKDIR /var/www/html
---> Running in 53a071a9db21
Removing intermediate container 53a071a9db21
---> cd9c5c32babc
Step 6/18 : ENV DEBIAN_FRONTEND noninteractive
---> Running in a9e045bff55e
Removing intermediate container a9e045bff55e
---> 0cc113458364
Step 7/18 : ENV TZ=UTC
---> Running in 9827c7d2f5e1
Removing intermediate container 9827c7d2f5e1
---> 0f209195f47a
Step 8/18 : RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
---> Running in ccafa5e32e94
Removing intermediate container ccafa5e32e94
---> b58053a83ede
Step 9/18 : RUN apt-get update && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 && mkdir -p ~/.gnupg && chmod 600 ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu hirsute main" > /etc/apt/sources.list.d/ppa_ondrej_php.list && apt-get update && apt-get install -y php8.1-cli php8.1-dev php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-curl php8.1-imap php8.1-mysql php8.1-mbstring php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap php8.1-intl php8.1-readline php8.1-ldap php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole php8.1-memcached php8.1-pcov php8.1-xdebug && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - && apt-get install -y nodejs && npm install -g npm && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get install -y yarn && apt-get install -y mysql-client && apt-get install -y postgresql-client && apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
---> Running in 279bb38a60ad
Err:1 http://archive.ubuntu.com/ubuntu hirsute InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu hirsute-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hirsute/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hirsute-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hirsute-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/hirsute-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
Package ca-certificates is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
Package gnupg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'gnupg' has no installation candidate
E: Unable to locate package gosu
E: Unable to locate package curl
E: Package 'ca-certificates' has no installation candidate
E: Unable to locate package zip
E: Unable to locate package unzip
E: Unable to locate package git
E: Unable to locate package supervisor
E: Unable to locate package sqlite3
E: Unable to locate package libcap2-bin
E: Unable to locate package libpng-dev
E: Unable to locate package python2
ERROR: Service 'laravel.test' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 && mkdir -p ~/.gnupg && chmod 600 ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu hirsute main" > /etc/apt/sources.list.d/ppa_ondrej_php.list && apt-get update && apt-get install -y php8.1-cli php8.1-dev php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-curl php8.1-imap php8.1-mysql php8.1-mbstring php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap php8.1-intl php8.1-readline php8.1-ldap php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole php8.1-memcached php8.1-pcov php8.1-xdebug && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - && apt-get install -y nodejs && npm install -g npm && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get install -y yarn && apt-get install -y mysql-client && apt-get install -y postgresql-client && apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*' returned a non-zero code: 100
知道我为什么会收到这个错误,我该如何解决?
基本上这个错误意味着容器和互联网之间没有连接,但我无法弄清楚为什么会这样。
感谢评论区的 Rwd who did mention this Github Issue 我注意到我使用的是旧版本的 docker
,我是 运行 Ubuntu 16.04 .. 后来我升级到20.04,在升级期间 docker 存储库被禁用,所以我暂时没有升级 docker。
所以我所做的只是重新安装 docker
:
我删除了旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
更新 apt 包索引并安装包以允许 apt 通过 HTTPS 使用存储库:
sudo apt update
sudo apt install \
ca-certificates \
curl \
gnupg \
lsb-release
添加Docker的官方GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
设置稳定存储库:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
最后:
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
因为我已经完成了 Post 安装步骤,所以我只是跳过它,重新启动 docker 后,错误消失了,sail up
运行 成功
我在让 Laravel Sail 处理新的 laravel 8
项目时遇到问题,我在 Ubuntu 20.04 LTS
上,我按照 Ubuntu 20.04 LTS
上的说明进行操作=21=]
到目前为止我所做的是:
首先我创建了一个新的 Laravel 项目:
composer create-project --prefer-dist laravel/laravel blog
然后安装sails :
composer require laravel/sail --dev
已发布的风帆 docker-compose.yml
:
php artisan sail:install
终于起航了:
./vendor/bin/sail up
但是我收到了这个错误:
ERROR: Service 'laravel.test' failed to build
这是完整的错误信息:
Pulling mysql (mysql/mysql-server:8.0)...
8.0: Pulling from mysql/mysql-server
639d1bdfca05: Pull complete
9e100c7b198d: Pull complete
427d2cdb963c: Pull complete
4436dc023066: Pull complete
5800f7888dd1: Pull complete
798cd8b6d3ec: Pull complete
c5ce8d5cf40e: Pull complete
Digest: sha256:91170bd4e012f0bf46b5141a38b612427b37692e8465cdffe9b0ca2d74d37d8a
Status: Downloaded newer image for mysql/mysql-server:8.0
Building laravel.test
Step 1/18 : FROM ubuntu:21.04
21.04: Pulling from library/ubuntu
9e6a0d5477cf: Pull complete
Digest: sha256:93a94c12448f393522f44d8a1b34936b7f76890adea34b80b87a245524d1d574
Status: Downloaded newer image for ubuntu:21.04
---> d662230a2592
Step 2/18 : LABEL maintainer="Taylor Otwell"
---> Running in 89940512e780
Removing intermediate container 89940512e780
---> 2b6050bc73a0
Step 3/18 : ARG WWWGROUP
---> Running in c33ba5cd161c
Removing intermediate container c33ba5cd161c
---> cd665779f65a
Step 4/18 : ARG NODE_VERSION=16
---> Running in 1fab74b70fc7
Removing intermediate container 1fab74b70fc7
---> 9fc2b36920f3
Step 5/18 : WORKDIR /var/www/html
---> Running in 53a071a9db21
Removing intermediate container 53a071a9db21
---> cd9c5c32babc
Step 6/18 : ENV DEBIAN_FRONTEND noninteractive
---> Running in a9e045bff55e
Removing intermediate container a9e045bff55e
---> 0cc113458364
Step 7/18 : ENV TZ=UTC
---> Running in 9827c7d2f5e1
Removing intermediate container 9827c7d2f5e1
---> 0f209195f47a
Step 8/18 : RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
---> Running in ccafa5e32e94
Removing intermediate container ccafa5e32e94
---> b58053a83ede
Step 9/18 : RUN apt-get update && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 && mkdir -p ~/.gnupg && chmod 600 ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu hirsute main" > /etc/apt/sources.list.d/ppa_ondrej_php.list && apt-get update && apt-get install -y php8.1-cli php8.1-dev php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-curl php8.1-imap php8.1-mysql php8.1-mbstring php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap php8.1-intl php8.1-readline php8.1-ldap php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole php8.1-memcached php8.1-pcov php8.1-xdebug && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - && apt-get install -y nodejs && npm install -g npm && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get install -y yarn && apt-get install -y mysql-client && apt-get install -y postgresql-client && apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
---> Running in 279bb38a60ad
Err:1 http://archive.ubuntu.com/ubuntu hirsute InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu hirsute-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hirsute/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hirsute-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hirsute-backports/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/hirsute-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
Package ca-certificates is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
Package gnupg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'gnupg' has no installation candidate
E: Unable to locate package gosu
E: Unable to locate package curl
E: Package 'ca-certificates' has no installation candidate
E: Unable to locate package zip
E: Unable to locate package unzip
E: Unable to locate package git
E: Unable to locate package supervisor
E: Unable to locate package sqlite3
E: Unable to locate package libcap2-bin
E: Unable to locate package libpng-dev
E: Unable to locate package python2
ERROR: Service 'laravel.test' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 && mkdir -p ~/.gnupg && chmod 600 ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu hirsute main" > /etc/apt/sources.list.d/ppa_ondrej_php.list && apt-get update && apt-get install -y php8.1-cli php8.1-dev php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-curl php8.1-imap php8.1-mysql php8.1-mbstring php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap php8.1-intl php8.1-readline php8.1-ldap php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole php8.1-memcached php8.1-pcov php8.1-xdebug && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer && curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - && apt-get install -y nodejs && npm install -g npm && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get install -y yarn && apt-get install -y mysql-client && apt-get install -y postgresql-client && apt-get -y autoremove && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*' returned a non-zero code: 100
知道我为什么会收到这个错误,我该如何解决?
基本上这个错误意味着容器和互联网之间没有连接,但我无法弄清楚为什么会这样。
感谢评论区的 Rwd who did mention this Github Issue 我注意到我使用的是旧版本的 docker
,我是 运行 Ubuntu 16.04 .. 后来我升级到20.04,在升级期间 docker 存储库被禁用,所以我暂时没有升级 docker。
所以我所做的只是重新安装 docker
:
我删除了旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
更新 apt 包索引并安装包以允许 apt 通过 HTTPS 使用存储库:
sudo apt update
sudo apt install \
ca-certificates \
curl \
gnupg \
lsb-release
添加Docker的官方GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
设置稳定存储库:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
最后:
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
因为我已经完成了 Post 安装步骤,所以我只是跳过它,重新启动 docker 后,错误消失了,sail up
运行 成功