skip to Main Content

I am setting up a new development environment in AWS Workspaces and I noticed that when I go to run docker build, I get the following errors:

 ---> Running in d18733d53c16
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease  Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease  Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease  Temporary failure resolving 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Someone over in Reddit mentioned that this is a known issue, but AWS Documentation doesn’t seem to mention this issue and I can’t find much more on this online.

It’s just a standard Docker file that’s been in use for about a year now with no issues. Just seems to be happening in AWS Workspaces for Linux.

2

Answers


  1. Chosen as BEST ANSWER

    I was finally able to get this resolved by adding DNS entries into my Dockerfile in the top before doing anything else.

    For example:

    RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && 
        apt-get update -qq && 
        apt-get upgrade -y &&  
    

    turned into:

    
    RUN echo "nameserver 1.1.1.1" > /etc/resolv.conf && 
        echo "nameserver 8.8.8.8" >> /etc/resolv.conf && 
        curl -sL https://deb.nodesource.com/setup_12.x | bash - && 
        apt-get update -qq && 
        apt-get upgrade -y &&  
    

    and now all is well.


  2. It seems that docker images using the bridged networking cannot access the DNS of the host. I suspect that AWS workspaces DNS are doing some filtering.

    docker run --rm busybox nslookup google.com
    ;; connection timed out; no servers could be reached
    

    Using host networking it works.

    docker run --rm --network=host busybox nslookup google.com
    Server:     10.2.8.238
    Address:    10.2.8.238:53
    
    Non-authoritative answer:
    Name:   google.com
    Address: 2a00:1450:4001:828::200
    

    If you need to use bridged networking, then I suggest to force docker to use Google’s DNS as a workaround

    cat /etc/docker/daemon.json 
    {
        "dns":["1.1.1.1","8.8.8.8"]
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search