Docker Community Forums

Share and learn in the Docker community.

Unknown host exception when running container with nat and port forwarding

beta

(Gareth Harcombe-Minson) #1

Expected behavior

If i run a container that makes outbound connections, and have port forwarding on and network set to nat, it should be able to resolve DNS and fetch data.

Actual behavior

Container logs show unknown host errors, inconsistently. If I look up some of the DNS entries on the host machine, they are then resolved in the container, but not always.

Information

OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.0-beta8.2
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x

Steps to reproduce the behavior

  1. Run “pinata set network nat” and “pinata set native/port-forwarding true”

  2. Use any container that makes outbound requests. Here’s a sample docker-compose.yml snippet:
    nexus-repo:
    container_name: nexus-repo
    image: sonatype/nexus3:3.0.0
    ports:

    • “8081:8081”
  3. Start the container and try to use one of the mirror repositories to fetch data.

  4. See errors like “java.net.UnknownHostException: bower.herokuapp.com


(Micheal Waltz) #2

I’m having similar issues, described here:


(Rvanderpool) #3

i have the same issue in our prod environment. i will get a few unknownHostExceptions then after 2 minutes it will resolve. it started to happen more frequently.