Skip to content
Browse docs

Docker Networks: Connect Your Containers

The Networks tab shows how your containers reach each other and the outside. Create a network so containers can talk by name, connect and disconnect containers, choose a driver, and remove the networks you no longer need.

Open in
Updated

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.

Every server has bridge, host, and none. The rest are networks you or your stacks made.

Find what you need

I want toInstead of typingGo to
Let two containers talkdocker network create, docker network connectConnect them
See my networksdocker network lsRead the list
See who is on a networkdocker network inspectSee the details
Create a networkdocker network createCreate a network
Connect or remove a containerdocker network connect, docker network disconnectConnect or disconnect
Delete a networkdocker network rmDelete a network
Clear out old networksdocker network pruneRemove 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.

Create network is at the top right of the Networks tab.

Type a name such as app-net, and keep the Driver on bridge. Click Create network.

For most networks, you only need a name.

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.

Connect a container is in the details of the network.

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.

MarkWhat it means
systemDocker needs this network, so you cannot delete it
internalContainers on it cannot reach outside networks
stackA Compose stack made it, and its next deploy makes it again if you delete it

Every server has these three networks:

NetworkWhat it does
bridgeThe default. Containers get a private address and can reach outside networks, but they cannot reach each other by name
hostThe container uses the network of the server directly, with no separation
noneThe 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.

FieldWhat it does
NameLetters, digits, dots, underscores, or hyphens. Start with a letter or a digit
DriverThe type of network. Keep bridge unless you know you need another one
Subnet, Gateway, IP rangeSet your own addresses. Leave them empty and Docker picks free ones
InternalNo access to outside networks. Use it for a database that nothing outside should reach
IPv6Turns on IPv6. It needs an IPv6 subnet
LabelsOptional notes for your own use

Which driver should I use?

DriverWhat it doesUse it when
bridgeA private network on this serverAlmost always
macvlanEach container gets its own MAC address and an IP address on your physical networkA container must look like a separate device on your network
ipvlanEach container gets an IP address on your physical network, using the MAC address of the serverSame as macvlan, where your network allows only one MAC address per port
overlayConnects containers on more than one serverYour 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 ingress and docker_gwbridge networks.
  • 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 seeWhat to do
Docker needs this network.Nothing. This is a system network
Used by and a container nameDisconnect 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.

Remove unused is at the top of the Networks tab.

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-net is 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.

Ask AI

Your privacy preferences. We use product analytics to improve CtrlOps. Google measurement runs without analytics cookies. Live chat stays off until you allow it. Cookie policy