Docker在安装composer时返回了一个非零代码:28
我使用docker compose来处理我的应用程序。但是当我构建Dokerfile时,在curl composer步骤中,它在5分钟后返回一个非零代码(28)作为错误。 我们的办公室通过VPN连接到互联网,我们的下载速度限制在120k Dockerfile:Docker在安装composer时返回了一个非零代码:28,docker,curl,docker-compose,composer-php,Docker,Curl,Docker Compose,Composer Php,我使用docker compose来处理我的应用程序。但是当我构建Dokerfile时,在curl composer步骤中,它在5分钟后返回一个非零代码(28)作为错误。 我们的办公室通过VPN连接到互联网,我们的下载速度限制在120k Dockerfile: # ubuntu strech FROM ubuntu:18.04 # debian no intract ENV DEBIAN_FRONTEND noninteractive RUN sed -i 's/archive.ubunt
# ubuntu strech
FROM ubuntu:18.04
# debian no intract
ENV DEBIAN_FRONTEND noninteractive
RUN sed -i 's/archive.ubuntu.com/ir.archive.ubuntu.com/g' /etc/apt/sources.list
RUN export COMPOSER_CACHE_DIR=/tmp/composer ; \
export LANG=en_US.utf8 ; \
export LC_ALL=C.UTF-8 ;
# Update and upgrade
RUN apt-get update -y \
&& apt-get -y upgrade && apt-get install -y --no-install-recommends apt-utils \
&& apt-get install -y --no-install-recommends \
curl locales ca-certificates \
build-essential sudo gnupg \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US
RUN apt-get clean
RUN apt-get install -y pkg-config apt-transport-https vim htop build-essential bash-completion git \
locales lsb-release php7.2-cli php7.2-common php7.2-curl php7.2-fpm php7.2-intl php7.2-soap php7.2-xml php7.2-gd \
php7.2-readline nginx-light php7.2-mbstring zip unzip nano iputils-ping
# install nodejs
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash -
RUN apt-get install -y nodejs
# composer and php
RUN curl https://getcomposer.org/composer.phar > /usr/bin/composer && chmod +x /usr/bin/composer && composer self-update
RUN sed -i 's/\/run\/php\/php7.2-fpm.sock/127.0.0.1:9000/g' /etc/php/7.2/fpm/pool.d/www.conf
# append fastcgi_param SCRIPT_FILENAME
RUN echo 'fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;' >> /etc/nginx/fastcgi_params
RUN service nginx restart
RUN apt-get purge -y build-essential dpkg-dev && apt-get autoremove -y && apt-get clean
COPY ./portal-entrypoint /usr/bin/portal-entrypoint
RUN chmod +x /usr/bin/portal-entrypoint
# ports
EXPOSE 80
# commands
CMD ["/bin/bash", "/usr/bin/portal-entrypoint"]
你的问题看起来很像网络问题。我感到奇怪的是,您的
apt
安装正在进行,但您在composer.phar的2MB上超时
我建议您手动完成这些步骤,从docker run-it ubuntu:18.04 bash
开始,在shell中执行run
命令,以便调试您的情况
在发布docker映像之前,另一条建议是减少或分组Dockerfile
中RUN
语句的数量,以减少层数,并可能使用较小的基本映像。在Docker中,使用说明运行
,复制
,添加
创建层,您可以查看有关的文档。您的问题看起来肯定像网络问题。我感到奇怪的是,您的apt
安装正在进行,但您在composer.phar的2MB上超时
我建议您手动完成这些步骤,从docker run-it ubuntu:18.04 bash
开始,在shell中执行run
命令,以便调试您的情况
在发布docker映像之前,另一条建议是减少或分组Dockerfile
中RUN
语句的数量,以减少层数,并可能使用较小的基本映像。在Docker中,您可以查看有关以下内容的文档:运行
、复制
、添加
创建层