When you deploy your docker container with port mapping, the network is automatically generated and the container assigned its own network.
atlex@ ~ % docker network ls
NETWORK ID NAME DRIVER SCOPE
ea37d3b97d11 bridge bridge local
01573b79ea81 host host local
85b9bca4df78 none null local
0abac39fbea3 dockerfiletest bridge local`
Details
atlex@ ~ % docker network inspect dockerfiletest
[
{
"Name": "dockerfiletest_default",
"Id": "0abac39fbea3f9fd55c1bf9ce1288b5623b3905c3ebd2ff9e60393bab8357a24",
"Created": "2020-04-15T15:52:24.875480173Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "dockerfiletest",
"com.docker.compose.version": "1.25.4"
}
}
]
https://docs.docker.com/engine/reference/commandline/network_create/
docker network create -d bridge my-new-network