Networking in Docker
View published ports of a container
$ docker container port <name-or-id>
List docker networks
$ docker network ls
bridge
or docker0
is a default docker network.
Inspect network
$ docker network inspect <network-name>
Create a new network
$ docker network create <name>
Create container with network
$ docker container run -d --name <container-name> --network <network-name> postgres
Connect existing container to network
$ docker network connect <network-name> <container-name>
Disconnect container from network
$ docker network disconnect <network-name> <container-name>