使用Docker Desktop + WSL2安装laravel8,执行./vendor/bin/sail up报错

使用Docker Desktop + WSL2安装laravel,执行./vendor/bin/sail up,执行到Building laravel.test这一步时,很耗时,最后构建失败,将sources.list换成国内镜像源也一样,执行打印信息如下:

root@DESKTOP-VM5G714:/example-app# ./vendor/bin/sail up
Building laravel.test
[+] Building 1030.5s (8/15)
 => [internal] load build definition from Dockerfile                                                               1.0s
 => => transferring dockerfile: 32B                                                                                0.0s
 => [internal] load .dockerignore                                                                                  1.6s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/ubuntu:21.04                                                    3.6s
 => [internal] load build context                                                                                  0.4s
 => => transferring context: 99B                                                                                   0.0s
 => [ 1/11] FROM docker.io/library/ubuntu:21.04@sha256:d5f1676ce05cd3251b583f19dad1793f9ab499baf463e730e494a640d6  0.0s
 => CACHED [ 2/11] WORKDIR /var/www/html                                                                           0.0s
 => CACHED [ 3/11] RUN ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo UTC > /etc/timezone                  0.0s
 => ERROR [ 4/11] RUN apt-get update     && apt-get install -y gnupg gosu curl ca-certificates zip unzip git s  1024.9s
------
 > [ 4/11] 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.0-cli php8.0-dev        php8.0-pgsql php8.0-sqlite3 php8.0-gd        php8.0-curl php8.0-memcached        php8.0-imap php8.0-mysql php8.0-mbstring        php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap        php8.0-intl php8.0-readline php8.0-pcov        php8.0-msgpack php8.0-igbinary php8.0-ldap        php8.0-redis php8.0-swoole php8.0-xdebug     && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer     && curl -sL https://deb.nodesource.com/setup_16.x | bash -     && apt-get install -y nodejs     && 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/*:
#7 2.100 Get:1 http://security.ubuntu.com/ubuntu hirsute-security InRelease [101 kB]
#7 2.102 Get:2 http://archive.ubuntu.com/ubuntu hirsute InRelease [269 kB]
#7 4.353 Get:3 http://security.ubuntu.com/ubuntu hirsute-security/main amd64 Packages [267 kB]
#7 6.640 Get:4 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease [109 kB]
#7 7.950 Get:5 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease [101 kB]
#7 9.222 Get:6 http://security.ubuntu.com/ubuntu hirsute-security/universe amd64 Packages [258 kB]
#7 9.919 Get:7 http://archive.ubuntu.com/ubuntu hirsute/multiverse amd64 Packages [252 kB]
#7 12.84 Get:8 http://security.ubuntu.com/ubuntu hirsute-security/multiverse amd64 Packages [3640 B]
#7 12.84 Get:9 http://security.ubuntu.com/ubuntu hirsute-security/restricted amd64 Packages [209 kB]
#7 14.73 Get:10 http://archive.ubuntu.com/ubuntu hirsute/main amd64 Packages [1791 kB]
#7 62.89 Get:11 http://archive.ubuntu.com/ubuntu hirsute/universe amd64 Packages [16.8 MB]
#7 347.9 Ign:11 http://archive.ubuntu.com/ubuntu hirsute/universe amd64 Packages
#7 348.4 Get:12 http://archive.ubuntu.com/ubuntu hirsute/restricted amd64 Packages [111 kB]
#7 355.8 Get:13 http://archive.ubuntu.com/ubuntu hirsute-updates/multiverse amd64 Packages [4814 B]
#7 355.8 Get:14 http://archive.ubuntu.com/ubuntu hirsute-updates/main amd64 Packages [418 kB]
#7 392.0 Ign:14 http://archive.ubuntu.com/ubuntu hirsute-updates/main amd64 Packages
#7 392.5 Get:15 http://archive.ubuntu.com/ubuntu hirsute-updates/restricted amd64 Packages [212 kB]
#7 394.2 Get:16 http://archive.ubuntu.com/ubuntu hirsute-updates/universe amd64 Packages [343 kB]
#7 395.9 Get:17 http://archive.ubuntu.com/ubuntu hirsute-backports/universe amd64 Packages [3949 B]
#7 396.1 Get:11 http://archive.ubuntu.com/ubuntu hirsute/universe amd64 Packages [16.8 MB]
#7 567.0 Ign:11 http://archive.ubuntu.com/ubuntu hirsute/universe amd64 Packages
#7 567.5 Get:14 http://archive.ubuntu.com/ubuntu hirsute-updates/main amd64 Packages [418 kB]
#7 567.5 Err:14 http://archive.ubuntu.com/ubuntu hirsute-updates/main amd64 Packages
#7 567.5   File has unexpected size (417773 != 417778). Mirror sync in progress? [IP: 91.189.88.142 80]
#7 567.5   Hashes of expected file:
#7 567.5    - Filesize:417778 [weak]
#7 567.5    - SHA256:5a0a56c0b9d1d5f054c71f02cb6500c34eb8ba8722e5c4225446721c591e29be
#7 567.5    - SHA1:989d330119dbbb0d47a9bf98d95bce0f92eb472d [weak]
#7 567.5    - MD5Sum:72463b077cfb54364bae445631068d47 [weak]
#7 567.5   Release file created at: Tue, 31 Aug 2021 19:35:59 +0000
#7 568.2 Get:11 http://archive.ubuntu.com/ubuntu hirsute/universe amd64 Packages [13.2 MB]
#7 722.2 Ign:11 http://archive.ubuntu.com/ubuntu hirsute/universe amd64 Packages
#7 722.7 Get:11 http://archive.ubuntu.com/ubuntu hirsute/universe amd64 Packages [13.2 MB]
#7 1023.6 Fetched 17.2 MB in 17min 2s (16.8 kB/s)
#7 1023.6 Reading package lists...
#7 1024.2 E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/hirsute-updates/main/binary-amd64/Packages.gz  File has unexpected size (417773 != 417778). Mirror sync in progress? [IP: 91.189.88.142 80]
#7 1024.2    Hashes of expected file:
#7 1024.2     - Filesize:417778 [weak]
#7 1024.2     - SHA256:5a0a56c0b9d1d5f054c71f02cb6500c34eb8ba8722e5c4225446721c591e29be
#7 1024.2     - SHA1:989d330119dbbb0d47a9bf98d95bce0f92eb472d [weak]
#7 1024.2     - MD5Sum:72463b077cfb54364bae445631068d47 [weak]
#7 1024.2    Release file created at: Tue, 31 Aug 2021 19:35:59 +0000
#7 1024.2 E: Some index files failed to download. They have been ignored, or old ones used instead.
------
executor failed running [/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.0-cli php8.0-dev        php8.0-pgsql php8.0-sqlite3 php8.0-gd        php8.0-curl php8.0-memcached        php8.0-imap php8.0-mysql php8.0-mbstring        php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap        php8.0-intl php8.0-readline php8.0-pcov        php8.0-msgpack php8.0-igbinary php8.0-ldap        php8.0-redis php8.0-swoole php8.0-xdebug     && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer     && curl -sL https://deb.nodesource.com/setup_16.x | bash -     && apt-get install -y nodejs     && 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/*]: exit code: 100
ERROR: Service 'laravel.test' failed to build : Build failed

多次尝试也是一样的结果,这到底是为啥呢

《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
讨论数量: 3

按照这篇搭建 Laravel Sail 开发环境 - MacOS文章内容,修改了/vendor/laravel/sail/runtimes/8.0下的Dockerfile文件,构建速度确实变快了,但还是出现下面问题

#9 11.19               Depends: libc6-dev but it is not going to be installed or
#9 11.19                        libc-dev
#9 11.20 E: Unable to correct problems, you have held broken packages.
------
executor failed running [/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 https://launchpad.proxy.ustclug.org/ondrej/php/ubuntu hirsute main" > /etc/apt/sources.list.d/ppa_ondrej_php.list     && apt-get update     && apt-get install -y php8.0-cli php8.0-dev        php8.0-pgsql php8.0-sqlite3 php8.0-gd        php8.0-curl php8.0-memcached        php8.0-imap php8.0-mysql php8.0-mbstring        php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap        php8.0-intl php8.0-readline php8.0-pcov        php8.0-msgpack php8.0-igbinary php8.0-ldap        php8.0-redis php8.0-swoole php8.0-xdebug     && curl -so /usr/bin/composer https://mirrors.aliyun.com/composer/composer.phar     && chmod a+x /usr/bin/composer     && composer --version     && curl -sL https://deb.nodesource.com/setup_16.x | bash -     && apt-get install -y nodejs     && 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/*]: exit code: 100
ERROR: Service 'laravel.test' failed to build : Build failed

这个为什么呢

3年前 评论
learner

我也遇到同样的问题,为什么就没人解答呢?花钱买的课程,安装遇到问题,都没人解答吗?

2年前 评论
heaker 2年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!