Search⌘ K

Docker CLI: Docker Networks

Explore how Docker networks allow containers to communicate by name instead of IP. Learn to create, attach, list, and delete networks using Docker CLI commands. Understand managing networks to organize container communication and maintain your Docker environment clean with system disk usage and prune commands.

Define a Docker network

Using a Docker network allows containers to communicate with each other using their container name (--name) rather than an IP address.

To delete or create a network we can use the following:

docker network create --driver bridge <network_name>

For example, to create a network named mynet, we can use:

docker network create --driver bridge
...