Video Thumbnail for Lesson
10.4: Networks

Interacting with Docker Networks

Throughout the course we have interacted with many different Docker objects. This module covers the additional options for how we can work with them.

Use docker network --help to see all the subcommands associated with Docker networks.

Commands

Create

Create a new network:

docker network create my-network

Inspect

Inspect a network:

docker network inspect my-network

List

List all networks:

docker network ls

Prune

Remove all unused networks:

docker network prune

Remove

Remove a specific network:

docker network rm my-network

Connect

Connect a container to a network:

docker network connect my-network container-id

Disconnect

Disconnect a container from a network:

docker network disconnect my-network container-id