Search code examples
dockerubuntu-14.04linux-mintdocker-build

Docker build error


I'm trying to build a Docker image, and are following the basic tutorial on Dockers own page. My Dockerfile looks like

FROM docker/whalesay:latest
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a | cowsay

That is exact the same as Docker provide. I'm running linux mint 18, and Docker is installed. I'm able to run images, like hello-world or others that I've build earlier and pushed to docker hub. (Used windows when i created them)

If I try to create images that I've created earlier, the same thing happens. It always crashes when RUN apt-get -y update && apt-get -y install.

Do anyone know how to solve this problem?

Thanks!

Picture of error message


Solution

  • As per the image it fails to resolve "archive.ubuntu.com" do the following as per references.

    1. Uncomment the following line in /etc/default/docker
    2. DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
    3. Restart the Docker service sudo service docker restart
    4. Delete any images which have cached the invalid DNS settings.
    5. Build again and the problem should be solved.

    Ref: Docker build "Could not resolve 'archive.ubuntu.com'" apt-get fails to install anything

    Actual Ref: https://www.digitalocean.com/community/questions/docker-on-ubuntu-14-04-could-not-resolve-archive-ubuntu-com