If I want to create my Docker file, it will not be able to connect to the network or at least DNS:
Sending build context to Docker daemon 15.95 MB Sending build context to Docker daemon Step 0 : FROM ruby ---> eeb85dfaa855 Step 1 : RUN apt-get update -qq && apt-get install -y build-essential libpq-dev ---> Running in ec8cbd41bcff W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/InRelease W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/InRelease W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/Release.gpg Could not resolve 'httpredir.debian.org' W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/Release.gpg Could not resolve 'httpredir.debian.org' W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg Could not resolve 'security.debian.org' W: Some index files failed to download. They have been ignored, or old ones used instead. Reading package lists... Building dependency tree... Reading state information... E: Unable to locate package build-essential INFO[0001] The command "/bin/sh -c apt-get update -qq && apt-get install -y build-essential libpq-dev" returned a non-zero code: 100
But if I execute the exact same command through docker run , it works:
docker run --name="test" ruby /bin/sh -c 'apt-get update -qq && apt-get install -y build-essential libpq-dev'
Does anyone have any ideas why docker build not working? I tried all the settings related to DNS on StackOverflow, for example, starting with dockers with -dns 8.8.8.8, etc.
Thank you in advance
source share