Search code examples
dockerubuntudocker-build

Docker tutorial (getting started) build fails (times out at STEP 2 of Dockerfile)


I am trying to build the container image of the "Getting-started" docker tutorial on ubuntu but building fails at the second step of the Dockerfile

RUN apk add --no-cache python2 g++ make

More specifically, it is unable to fetch the some .tar.gz files from https://dl-cdn.alpinelinux.org/ resulting in a time out:

fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/main: operation timed out
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.15/community: operation timed out

And then results in ERROR because of the missing packages.

I could download the files manually from the https://dl-cdn.alpinelinux.org/ website so I don't understand with the fetching fails.

How could this be resolved? Thank you


Solution

  • As I expected, the source of the problem was some idiotic mistake I did during the installation. I had some trouble during the linux post installation procedure so I started doing things without completely comprehending what I was doing.

    More specificaly, I configured docker (in the ~/.docker/config.json) to use a proxy server even thought I am not behind one. Once I removed the following lines (which I, myself, put in there in the first place) from the configuration file, everything worked fine.

    {
     "proxies":
     {
       "default":
       {
         "httpProxy": "http://192.168.1.12:3128",
         "httpsProxy": "http://192.168.1.12:3128",
         "noProxy": "*.test.example.com,.example2.com,127.0.0.0/8"
       }
     }
    }