我试图创build一个Apache + PHPdocker容器,但我得到一个生成错误。
这是我的dockerfile,
FROM ubuntu:14.04 MAINTAINER Mizanur Rahman RUN apt-get update RUN apt-get -y upgrade RUN apt-get install -y apache2 libapache2-mod-php5 php5-mysql php5-gd php-pear php-apc php5-curl curl lynx-cur php5-intl RUN a2enmod php5 RUN a2enmod rewrite RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php5/apache2/php.ini RUN sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /etc/php5/apache2/php.ini ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 EXPOSE 80 # Copy site into place. ADD www /var/www/site # Update the default apache site with the config we created. ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf # By default, simply start apache. CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
这是构build输出,
Sending build context to Docker daemon 44.23 MB Sending build context to Docker daemon Step 0 : FROM ubuntu:14.04 ---> fa81ed084842 Step 1 : MAINTAINER Mizanur Rahman <[email protected]> ---> Using cache ---> 4c5dfddabbc7 Step 2 : RUN apt-get update ---> Running in 938037477c9c Ign http://archive.ubuntu.com trusty InRelease Ign http://archive.ubuntu.com trusty-updates InRelease Ign http://archive.ubuntu.com trusty-security InRelease Err http://archive.ubuntu.com trusty Release.gpg Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-updates Release.gpg Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-security Release.gpg Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Ign http://archive.ubuntu.com trusty Release Ign http://archive.ubuntu.com trusty-updates Release Ign http://archive.ubuntu.com trusty-security Release Ign http://archive.ubuntu.com trusty/main amd64 Packages/DiffIndex Ign http://archive.ubuntu.com trusty/restricted amd64 Packages/DiffIndex Err http://archive.ubuntu.com trusty/main Sources Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty/restricted Sources Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty/universe Sources Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty/universe amd64 Packages Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-updates/main Sources Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-updates/restricted Sources Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-updates/universe Sources Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-updates/main amd64 Packages Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-updates/restricted amd64 Packages Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-updates/universe amd64 Packages Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-security/main Sources Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-security/restricted Sources Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-security/universe Sources Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-security/main amd64 Packages Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-security/restricted amd64 Packages Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty-security/universe amd64 Packages Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty/main amd64 Packages Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) Err http://archive.ubuntu.com trusty/restricted amd64 Packages Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/main/source/Sources Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname) W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/t
最后,这是错误信息
The command [/bin/sh -c apt-get update] returned a non-zero code: 100
我已经尝试了几个解决scheme来解决这个问题,他们都没有为我工作。
例如,
Docker容器无法parsingUbuntu 14.04桌面主机上的DNS
命令[/ bin / sh -c apt-get update]返回一个非零的代码:100
谁能帮我这个? 提前致谢。
您的问题与防火墙设置有关。 以root用户身份执行:
sudo iptables -L -n -v
列出所有防火墙规则并检查FORWARD链策略。 必须设置为接受Docker DNSparsing才能正常工作。
如果设置为DROP或REJECT,则执行:
sudo ufw disable
如果你没有安装ufw,那么执行:
sudo iptables -X sudo iptables -t nat -F sudo iptables -t nat -X sudo iptables -t mangle -F sudo iptables -t mangle -X sudo iptables -P INPUT ACCEPT sudo iptables -P FORWARD ACCEPT sudo iptables -P OUTPUT ACCEPT