Create: docker network create
In your compose files, you can join a network with:
service:
myservice:
networks:
- <network-name>
networks:
<network-name>:
external: true
Using the externalflag is recommended if you created the network externally.
Defaults
When not explicitly using networks in your docker compose file, Docker creates a default bridge network for all services in your docker compose configuration.
Utility
Prune unused networks: docker network prune
Inspect
Use it to inspect bindings on the host system
docker inspect <container> --format '{{json .NetworkSettings.Ports}}'
Should return something: {"30000/tcp":null