【发布时间】:2019-05-10 10:11:57
【问题描述】:
我使用 docker-compose 来处理我的应用程序。但是当我构建 Dokerfile 时,它会在 5 分钟后在 curl composer 步骤返回一个非零代码 (28) 作为错误。 我们的办公室通过 VPN 连接到互联网,我们的下载速度限制为最大 120k。
Dockerfile:
# 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"]
【问题讨论】:
标签: docker curl docker-compose composer-php