Docker container cannot access network

All my containers cannot access internet if run without ‘–net=host’.

Environment

  • distro: Ubuntu 13.04
  • docker: 1.6.2
  • go: go1.4.2
  • ufw: DEFAULT_FORWARD_POLICY="ACCEPT"
  • 2375 port: 2375/tcp ALLOW Anywhere
  • docker daemon:
    docker -d -H unix:///var/run/docker.sock --bip=172.17.42.1/16 -b docker0
  • docker0 interface: docker0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN

Question

I can append --net=host manually, but kubernetes always runs the docker without it. So any dockers in pods cannot pull images. What’s worse, the Guestbook example failed either with the error connection refused, even add x.x.x.x redis-master in /etc/hosts of slaves.

  • Use environment variable in a quote
  • In dockerized python3 ftp command RETR throws a ConnectionResetError
  • Docker, communicating between hosts on different bridges
  • Saltstack docker.login returns APIError: 500 Server Error?
  • How can I pass arguments to a docker container with a python entry-point script using command?
  • running simple web app on docker tomcat container
  • So is there a way to use host mode as docker daemon arg, or the kube arg?

  • Does docker support command aliases similar to Git aliases?
  • docker - local DNS
  • Can not access kubernetes master from the container of pods according DNS
  • Docker pull from inside vagrant box requires constant pressing of key
  • Add docker container to network under two different names
  • Docker Distributed Application Bundle(DAB) no network creation options
  • One Solution collect form web for “Docker container cannot access network”

    Kubernetes allows you to enable host networking on a per-pod basis. See the configuration for the Kubernetes apiserver for an example of where in the yaml config you should specify "hostNetwork": true.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.