The Networks tab shows how your containers reach each other and the outside. Most of the time, you only need it for one job: letting two containers talk to each other.
Find what you need
| I want to | Instead of typing | Go to |
|---|---|---|
| Let two containers talk | docker network create, docker network connect | Connect them |
| See my networks | docker network ls | Read the list |
| See who is on a network | docker network inspect | See the details |
| Create a network | docker network create | Create a network |
| Connect or remove a container | docker network connect, docker network disconnect | Connect or disconnect |
| Delete a network | docker network rm | Delete a network |
| Clear out old networks | docker network prune | Remove unused |
Let two containers talk to each other
Say your api container needs to reach your db container.
Create a network
Click Create network at the top right of the tab.
Type a name such as app-net, and keep the Driver on bridge. Click Create network.
Connect both containers
Click the new network in the list. Under Connect a container, pick api and click Connect. Do the same for db. They do not need to restart.
Use the container name
In your app, use the name of the other container as its host name. For example, api can reach the database at db:5432. Keep the same name if the container is recreated, and your app keeps working even if the IP address changes.
Read the network list
Each row shows the name, driver, scope, subnet, and how many containers name that network, stopped ones too. Search networks… finds a network by its name, driver, or subnet.
| Mark | What it means |
|---|---|
| system | Docker needs this network, so you cannot delete it |
| internal | Containers on it cannot reach outside networks |
| stack | A Compose stack made it, and its next deploy makes it again if you delete it |
Every server has these three networks:
| Network | What it does |
|---|---|
bridge | The default. Containers get a private address and can reach outside networks, but they cannot reach each other by name |
host | The container uses the network of the server directly, with no separation |
none | The container has no network at all |
See the details of a network
Click a row to open its details: the Summary, IPAM with its subnet and gateway, Containers with each container's address and aliases, Options, and Labels. View raw inspect shows the full docker inspect output.
Create a network
Click Create network. Only Name is required. Leave the rest alone unless you have a reason to change it.
| Field | What it does |
|---|---|
| Name | Letters, digits, dots, underscores, or hyphens. Start with a letter or a digit |
| Driver | The type of network. Keep bridge unless you know you need another one |
| Subnet, Gateway, IP range | Set your own addresses. Leave them empty and Docker picks free ones |
| Internal | No access to outside networks. Use it for a database that nothing outside should reach |
| IPv6 | Turns on IPv6. It needs an IPv6 subnet |
| Labels | Optional notes for your own use |
Which driver should I use?
| Driver | What it does | Use it when |
|---|---|---|
bridge | A private network on this server | Almost always |
macvlan | Each container gets its own MAC address and an IP address on your physical network | A container must look like a separate device on your network |
ipvlan | Each container gets an IP address on your physical network, using the MAC address of the server | Same as macvlan, where your network allows only one MAC address per port |
overlay | Connects containers on more than one server | Your containers run on several servers. It needs Swarm mode |
host and none are in the list but turned off, because every server already has them.
These two drivers also ask for a Parent interface, such as eth0, a Mode (L2 or L3), and a Subnet. CtrlOps fills in what it can read from the server.
Use overlay and Swarm mode
Overlay needs Swarm mode. If it is off, CtrlOps says Overlay needs Swarm mode. Swarm mode is off on this server., with two choices: Use bridge and Start Swarm mode. If your containers are all on one server, click Use bridge.
Start Swarm mode shows what will change before you confirm:
- This server becomes a Swarm manager, and Docker adds the
ingressanddocker_gwbridgenetworks. - Running containers do not stop, and nothing is downloaded.
To add another server, click Copy join command and run the command on that server. CtrlOps can start Swarm mode for an overlay network, but it does not manage Swarm services.
Connect or disconnect a container
You can do this from either side:
- From the network: open its details and use Connect a container, or Disconnect on a row.
- From the container: open its Network tab and use Connect to a network.
Alias is optional. It gives the container a second name on this network, such as db for a container named postgres-prod.
Delete a network
Click Delete on the row and confirm. The button is off in these cases, and it tells you why:
| You see | What to do |
|---|---|
| Docker needs this network. | Nothing. This is a system network |
| Used by and a container name | Disconnect or delete that container first. A stopped container counts too |
| Swarm manages this network. | Change it with the Swarm tools on a manager server |
Remove unused networks
Click Remove unused to see the networks no container names, and type prune to confirm. Docker's own networks are never listed.
Networks of stopped stacks stay, because those stacks need them to start again. Prune System can remove them along with their containers.
Tips
- Give each app its own network. A database on
app-netis only reachable by the containers you connected to it. - Use names, not IP addresses. A container's IP address can change when it is recreated, and its name does not.
- Use Internal for databases. The database can still talk to your app, but it cannot reach outside networks.
Troubleshooting
Most failures show Show details with the Likely cause, Retry where it helps, and Copy report. Send that report with any support question.
My containers cannot reach each other
Check that both are on the same network, and not only on the default bridge, which has no names. Open the network and look at Containers. Use the container name and the port inside the container, not the published port. Also check that your app listens on 0.0.0.0, not 127.0.0.1.
My container cannot reach the internet
Check that its network is not marked internal, and that the server itself can reach the internet.
This subnet is in use on the server.
Another network or the server already uses those addresses. Type a different subnet, or leave it empty so Docker picks a free one.
Ports do not apply to the host, none, macvlan or ipvlan networks.
On these networks, the container does not use Docker's port mapping. Pick a bridge network if you need a published port.
A container on the host or none network cannot join other networks.
That container does not use Docker's networks at all, so it cannot join another one. To change this, recreate it on a bridge network.
This interface is not on the server.
The Parent interface does not exist. Pick one from the list. If the message is Another network uses this interface., pick another, or type a VLAN name such as eth0.10.
This server is a Swarm worker.
A Swarm worker cannot make an overlay network. Make it on the manager server.
Docker shows no networks.
Docker always has bridge, host, and none, so this means CtrlOps could not read them. Click Retry.
Frequently Asked Questions
Do I need to create a network to run a container?
No. A container joins the default bridge network if you pick nothing. Create your own network when containers need to reach each other by name.
Why can't my containers reach each other by name?
Containers on the default bridge network cannot reach each other by name. Create your own network and connect both containers to it. Containers in the same Compose stack already share a network.
Does a Docker network open my app to the internet?
No. A network only connects containers. People outside reach a container through a published port, which you set under Port mapping. Internal networks also block the containers from reaching outside networks.
Does creating a network restart my containers?
No. Creating a network changes nothing for running containers, and you can connect a running container to a network without restarting it.
Can I delete the bridge, host, or none network?
No. Docker needs them, so Delete is off for these networks.
Does choosing overlay start Docker Swarm?
Only if you confirm. Overlay needs Swarm mode, so CtrlOps shows what will change and asks first. For containers on one server, use bridge, which does not need Swarm.
