FreeKB - docker network command (create a network on Linux)
Docker - docker network command (create a network on Linux)

This assumes you have installed Docker on Linux and Docker is running. Before creating a docker network, ensure the host Linux operating system has a firewall deamon running, such as firewalld or iptables. The following command creates a docker network named foo-network.

docker network create foo-network


The docker network ls command can be used to display the docker networks.

docker network ls


Which should return something like this.

233g3acb112a   foo-network    bridge      local


The docker volume inspect command can be used to display the configuration of the network.

docker network inspect foo-network


Which should return JSON something like this.

  "EnableIPv6": false,
  "IPAM" {
    "Options" {},
    "Config": [
        "Subnet": "",
        "Gateway": ""
  "Internal": false,
  "Attachable": false,
  "Containers": {},
  "Options": {},
  "Labels": {}


When using the docker run command to install an image, the --network option can be used to configure the image to use the network, like this.

docker run --network=foo-network bar:latest


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter f64f4 in the box below so that we can be sure you are a human.