Skip to content

Docker network

List all containers including their IP addresses:

docker inspect --format='{{.Name}} {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -q)

Test network access from within a container

docker run -it debian sh -c 'ping -c 1 -W 2 1.1.1.1'

Test network resolution:

docker run -it debian sh -c 'timeout 2 ping -c 1 ix.de'