TOOL » VIRTUAL_ENVIRONMENT » DOCKER

Network

Usage

When access to another containers is required, it is better to create a custom network.

The main advantage is that containers can not only communicate by IP address, but can also resolve a container name to an IP address.

shell
docker network COMMAND
CommandDescription
connectConnect a container to a network.
createCreate a network.
lsList networks.
rmRemove one or more networks.
pruneRemove all unused networks.

Available drivers

DriverDescription
bridgeDefault driver. Used when your applications run in standalone containers that need to communicate.
hostRemove network isolation between the container and the Docker host, and use the host’s networking directly.
overlayConnect multiple Docker daemons together and enable swarm services to communicate with each other.
macvlanAllow you to assign a MAC address to a container, making it appear as a physical device on your network.
noneDisable all networking.

Example

shell
docker network create --driver bridge test-net
docker network rm test-net