Questions tagged [docker-networking]

For questions about the network configuration of the docker service or of the containers running in it.

The Docker paravirtualization engine has multiple models to configure the network access of the containers:

  • bridge: in other virtualization engines, this is called as "NAT network". What other virtualization engines call "bridged network", is called "macvlan" in the docker terminology (see below). The docker containers are on a virtual local network (172.17.0.0/16), their external connections are NAT-ted to the local network address of the host machine.
  • host: The containers use the same network interface as the host. This has the side-effect that they multiple services can not bind to the same ports simultaneously.
  • overlay: essentially a shared bridged network among multiple docker hosts of a docker swarm.
  • macvlan: in other virtualization engines, this is called "bridged network". The docker host creates a virtual "clone" of a host network interface, with an alternate MAC address, and binds it to the containers. The containers will be seen on the local network of the host, as if they would be entirely different machines (with their separate MAC and IP addressing).
  • none: the container has no access to any network.
  • there is also an option to develop custom network plugins.

References

689 questions
2014
votes
34 answers

From inside of a Docker container, how do I connect to the localhost of the machine?

So I have a Nginx running inside a docker container, I have a mysql running on localhost, I want to connect to the MySql from within my Nginx. The MySql is running on localhost and not exposing a port to the outside world, so its bound on localhost,…
Phil
  • 32,917
  • 29
  • 99
  • 154
545
votes
5 answers

How can I expose more than 1 port with Docker?

So I have 3 ports that should be exposed to the machine's interface. Is it possible to do this with a Docker container?
nubela
  • 14,600
  • 22
  • 68
  • 115
125
votes
4 answers

Docker Networking Disabled: WARNING: IPv4 forwarding is disabled. Networking will not work

Containers in a host "suddenly" loses connection to outside-world containers. However, some hosts were refreshed and suddenly we had the following situation: The host can communicate with other hosts. Containers running in the host cannot…
Marcello de Sales
  • 17,280
  • 12
  • 60
  • 72
118
votes
3 answers

What does --net=host option in Docker command really do?

I'm a little bit beginner to Docker. I couldn't find any clear description of what this option does in docker run command in deep and bit confused about it. Can we use it to access the applications running on docker containers without specifying a…
Ravindu Fernando
  • 3,346
  • 3
  • 16
  • 21
110
votes
17 answers

Docker Networking - nginx: [emerg] host not found in upstream

I have recently started migrating to Docker 1.9 and Docker-Compose 1.5's networking features to replace using links. So far with links there were no problems with nginx connecting to my php5-fpm fastcgi server located in a different server in one…
Attila Szeremi
  • 4,291
  • 5
  • 32
  • 60
61
votes
7 answers

How make openvpn work with docker

I have recently installed privacy vpn, and it turns out that enabled openvpn breaks docker. When I try to run docker-compose up i get following error ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to…
jb.
  • 20,419
  • 16
  • 91
  • 130
49
votes
8 answers

Docker Network not Found

In our team, we are currently transitioning to Docker to deploy everything on our server. We are using Docker Swarm and multiple (10+) compose files defining plenty (20+) of services. Everything works beautifully so far, except when we take down our…
borchero
  • 4,555
  • 6
  • 39
  • 70
49
votes
1 answer

docker-compose: difference between network and link

I'm learning docker. I see those two terms make me confuse. For example here is a docker-compose that defined two services redis and web-app. services: redis: container_name: redis image: redis:latest ports: - "6379:6379" …
Trần Kim Dự
  • 4,962
  • 6
  • 39
  • 81
45
votes
5 answers

Start container with multiple network interfaces

With 1.9, is there a way to start a container directly with two or more network interfaces? You can do it after the container is started with "docker network connect", but it means the process is already running and might miss the creation of the…
Robert
  • 499
  • 1
  • 5
  • 8
41
votes
4 answers

Restrict Internet Access - Docker Container

I have a situation to restrict internet access of the container in load balancer network. for example in that below picture Only container4 connects to the Internet; other three only communicate through container4 with the outside world. For…
Bilal Usean
  • 1,574
  • 2
  • 16
  • 35
36
votes
4 answers

no internet inside docker-compose service

I cannot reach external network from docker-compose containers. Consider the following docker-compose file: version: '2' services: nginx: image: nginx Using the simple docker run -it nginx bash I manage to reach external IPs or Internet…
orshachar
  • 4,367
  • 12
  • 40
  • 59
34
votes
5 answers

Docker 1.10 access a container by its hostname from a host machine

I have the Docker version 1.10 with embedded DNS service. I have created two service containers in my docker-compose file. They are reachable each other by hostname and by IP, but when I would like reach one of them from the host machine, it…
Adam Bernau
  • 649
  • 2
  • 6
  • 12
27
votes
7 answers

How can I forward a port from one docker container to another?

I commonly see solutions that expose a docker container's port to the host. In my case I want to forward a local port from one container, to another. Let's say I run a service on container A that has a hard-coded configuration to access db on…
Marinos An
  • 6,191
  • 2
  • 35
  • 68
21
votes
3 answers

what is the use of HOST and NONE network in docker?

Trying to understand the docker networks, Docker creates the following networks automatically: # docker network ls NETWORK ID NAME DRIVER SCOPE 67b4afa88032 bridge bridge local …
Here_2_learn
  • 3,823
  • 8
  • 40
  • 64
20
votes
3 answers

Communicating between Docker containers in different networks on the same host

Any possibility to make containers in different networks within the same host to communicate? Please note that I am not using docker-compose at the moment. The following is a summary of what I did. I created two networks using the following…
Abraham Jaison
  • 359
  • 1
  • 3
  • 14
1
2 3
45 46