我正在使用Ubuntu Docker镜像:ubuntu:14.04
我想使用以下方式更新我的树:
RUN apt-get update
但我一直收到这个错误:
W: GPG error: http://archive.ubuntu.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
我尝试了多种方法,包括apt-get clean
和RUN rm -R /var/lib/apt/lists/* -vf
他们都没有解决问题。
任何想法如何忽略此错误并继续构建容器?
更新
这是我的完整Dockerfile:
FROM ubuntu:14.04
VOLUME ["/var/www"]
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y --force-yes redis-tools git nano curl sendmail openssh-server apache2 supervisor php5 php5-curl php5-cli libapache2-mod-php5 php5-gd php5-json php5-ldap php5-mysql php5-pgsql php5-mcrypt php5-xdebug
RUN mkdir -p /var/run/sshd
RUN mkdir -p /var/log/supervisor
RUN useradd ubuntu -d /home/ubuntu
RUN usermod -a -G sudo ubuntu
RUN mkdir -p /home/ubuntu/.ssh
RUN chmod 700 /home/ubuntu/.ssh
RUN chown ubuntu:ubuntu /home/ubuntu/.ssh
ADD apache_default /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite
RUN php5enmod mcrypt
RUN sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php5/apache2/php.ini
RUN sed -ri 's/^display_errors\s*=\s*Off/display_errors = On/g' /etc/php5/cli/php.ini
RUN sed -ri 's/^PermitRootLogin.*$/PermitRootLogin yes/g' /etc/ssh/sshd_config
#Add XDEBUG
RUN echo "[xdebug]" >> /etc/php5/apache2/php.ini
RUN echo "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so" >> /etc/php5/apache2/php.ini
RUN echo "xdebug.remote_enable=1" >> /etc/php5/apache2/php.ini
RUN echo "xdebug.remote_connect_back=1" >> /etc/php5/apache2/php.ini
RUN echo "xdebug.remote_port=9000" >> /etc/php5/apache2/php.ini
RUN echo "xdebug.show_local_vars=0" >> /etc/php5/apache2/php.ini
RUN echo "xdebug.var_display_max_data=10000" >> /etc/php5/apache2/php.ini
RUN echo "xdebug.var_display_max_depth=20" >> /etc/php5/apache2/php.ini
RUN echo "xdebug.show_exception_trace=0" >> /etc/php5/apache2/php.ini
#Allow SSH Root
ADD sshd_config /etc/ssh/sshd_config
RUN service ssh reload
RUN service ssh restart
#Install Composer
RUN curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ADD run /usr/local/bin/
RUN chmod +x /usr/local/bin/run
EXPOSE 22 80
CMD ["/usr/local/bin/run"]
答案 0 :(得分:1)
It is possible you have an outdated version of Ubuntu in your image cache. Run docker pull ubuntu:14.04
to make sure you have the latest version present.
apt-get update
should work out of the box; if it's not working, something else is wrong (possibly a caching mirror that's out of date, or a proxy server causing issues).
Also, to skip docker's caching mechanism during a build, you can use the --no-cache
option; docker build --no-cache .
答案 1 :(得分:1)
就我而言,这是由于我的 mac 上的屏幕时间。 (为什么 tf 在 MacOS 安装时自动启用??)。无论如何,前往设置,找到屏幕时间,然后禁用该死的东西。希望这能帮助一些可怜的 Mac 用户损失很多时间。
答案 2 :(得分:-1)
尝试在dockerfile中RUN apt-get update
之前添加此内容:
RUN gpg --keyserver subkeys.pgp.net --recv 16126D3A3E5C1192
RUN gpg --export --armor 16126D3A3E5C1192 | sudo apt-key add -