Skip to content

Docker Networks

Container networking refers to the ability for containers to connect to and communicate with each other, or to non-Docker workloads.

To create a network, run:

Text Only
docker network create my-network

If using Docker Swarm across multiple computers, you'll need to do:

Text Only
docker network create -d overlay my-overlay-network

to allow the multiple Docker Daemons to communicate with each other.

Now, you can connect Docker containers to this network using:

Text Only
docker network connect my-network my-container

or disconnect with:

Text Only
docker network disconnect my-network my-container

In your docker-compose file, you can also specify the networks there as such:

YAML
version: '3.7'

services:
  frb-master:
    image: chimefrb/frb-master:latest
    networks:
      - frb_master_network

networks:
  frb_master_network:

Now, you can see all the connected services with:

Text Only
docker network inspect my-network