Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker - Mac OSX Ubuntu fails on apt-get update

I'm using Ubuntu Docker image: ubuntu:14.04

I want to update my tree using:

RUN apt-get  update

But i'm keep getting this error:

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.

I tried several method including apt-get clean and RUN rm -R /var/lib/apt/lists/* -vf

None of them solves the problem.

Any idea how can I ignore this error and keep building the container?

UPDATE:

That's my full 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"]
like image 300
Asaf Nevo Avatar asked Apr 03 '16 13:04

Asaf Nevo


People also ask

Should you run apt get update in Docker?

Avoid RUN apt-get upgrade …, as many of the “essential” packages from the parent images cannot upgrade inside an unprivileged container. To be clear: RUN commands happen during image build, not during container startup. The documentation there is saying “build your images without installing security updates”.

Can Docker run Ubuntu on Mac?

Multipass has a new workflow tailored to run Docker containers on macOS, Windows or Linux. One single command, no dependencies, full flexibility. Multipass exists to bring Ubuntu-based development to the operating system of your choice.

Can Docker Mac run Linux containers?

You can run both Linux and Windows programs and executables in Docker containers. The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64). Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.


1 Answers

In my case it was due to Screen Time on my mac. (why tf is this autoenabled on MacOS install??). Anyway, head to setting, find Screen Time, and then disable the damn thing. Hopefully this help many hours lost for some poor Mac user.

like image 64
Just a coder Avatar answered Sep 20 '22 20:09

Just a coder