Mac在安装docker sail过程中出现 Depends:xxx to be installed「已解决」
1). 遇到的问题
我在根据教程安装Laravel docker sail 的时候,出现了如下错误
我自己试过使用aptitude 替换 apt-get,但没产生任何效果
我现在不知道该如何继续进行下去了,没思路了…还希望大家能帮我看看,谢谢
#9 6.582 The following packages have unmet dependencies:
#9 6.679 gnupg : Depends: gpgv (< 2.2.19-3ubuntu2.1.1~) but 2.2.20-1ubuntu3 is to be installed
#9 6.681 perl : Depends: perl-base (= 5.30.0-9ubuntu0.2) but 5.32.1-3ubuntu2.1 is to be installed
#9 6.681 Recommends: netbase but it is not going to be installed
#9 6.681 perl-base : Breaks: perl (< 5.32.1~) but 5.30.0-9ubuntu0.2 is to be installed
#9 6.682 zlib1g-dev : Depends: zlib1g (= 1:1.2.11.dfsg-2ubuntu1.2) but 1:1.2.11.dfsg-2ubuntu6 is to be installed
#9 6.682 Depends: libc6-dev but it is not going to be installed or
#9 6.682 libc-dev
#9 6.697 E: Unable to correct problems, you have held broken packages.
2). 我的Mac版本
3).我的Dockerfile
FROM ubuntu:21.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=16
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ADD sources.list /etc/apt/
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 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_$NODE_VERSION.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/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.0
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.0/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]
4).我的尝试
我还尝试过将
FROM ubuntu:21.04
替换为
FROM ubuntu:latest
但还是发生了错误,好像依然是依赖问题,但搜索了半天并没找到很好的解决办法
#9 33.76 Get:7 https://launchpad.proxy.ustclug.org/ondrej/php/ubuntu hirsute/main amd64 Packages [157 kB]
#9 33.91 Fetched 181 kB in 1s (148 kB/s)
#9 33.91 Reading package lists...
#9 34.98 Reading package lists...
#9 35.93 Building dependency tree...
#9 36.11 Reading state information...
#9 36.22 Some packages could not be installed. This may mean that you have
#9 36.22 requested an impossible situation or if you are using the unstable
#9 36.22 distribution that some required packages have not yet been created
#9 36.22 or been moved out of Incoming.
#9 36.22 The following information may help to resolve the situation:
#9 36.22
#9 36.22 The following packages have unmet dependencies:
#9 36.32 php8.0-bcmath : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 php8.0-cli : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 Depends: php8.0-opcache but it is not going to be installed
#9 36.32 Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 36.32 Depends: libxml2 (>= 2.8.0) but it is not going to be installed
#9 36.32 php8.0-curl : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 php8.0-dev : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 Recommends: pkg-php-tools but it is not going to be installed
#9 36.32 php8.0-gd : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 php8.0-igbinary : Depends: php8.0-common but it is not going to be installed
#9 36.32 php8.0-imap : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 php8.0-intl : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 Depends: libicu67 (>= 67.1-1~) but it is not installable
#9 36.32 php8.0-ldap : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 php8.0-mbstring : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 php8.0-memcached : Depends: php8.0-common but it is not going to be installed
#9 36.32 php8.0-msgpack : Depends: php8.0-common but it is not going to be installed
#9 36.32 php8.0-mysql : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 php8.0-pcov : Depends: php8.0-common but it is not going to be installed
#9 36.32 Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 36.32 php8.0-pgsql : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 php8.0-readline : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 php8.0-redis : Depends: php8.0-common but it is not going to be installed
#9 36.32 php8.0-soap : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 36.32 Depends: libxml2 (>= 2.7.4) but it is not going to be installed
#9 36.32 php8.0-sqlite3 : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 php8.0-swoole : Depends: php8.0-common but it is not going to be installed
#9 36.32 Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 36.32 php8.0-xdebug : Depends: php8.0-common but it is not going to be installed
#9 36.32 Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 36.32 php8.0-xml : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 36.32 Depends: libxml2 (>= 2.9.0) but it is not going to be installed
#9 36.32 Depends: libxslt1.1 (>= 1.1.25) but it is not going to be installed
#9 36.32 php8.0-zip : Depends: php8.0-common (= 8.0.12-1+ubuntu21.04.1+deb.sury.org+1) but it is not going to be installed
#9 36.32 Depends: libc6 (>= 2.33) but 2.31-0ubuntu9.2 is to be installed
#9 36.32 Depends: libzip4 (>= 1.7.0) but it is not installable
#9 36.34 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_$NODE_VERSION.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
我的问题已经解决
首先修改 Dockerfile 将
FROM ubuntu:21.04
改为FROM ubuntu:latest
后面还会遇到php的问题,具体解决过程我写了博客(Laravel docker sail 搭建
),到时候遇到问题的小伙伴可以去看看,本次搭建查资料连带尝试一共花费一天左右的时间