I'm trying to debug some docker containers that aren't allowing outgoing connections. The docker documentation says that allowing outgoing connections is the default behavior of the default bridge
network driver, but that the none
driver does not allow outgoing connections. I'd like to be able to check which network driver these containers are using, but I haven't been able to find the right switches in docker ps
(or any other command) that would allow me to do this.
How can I get the network driver for a particular docker container from the command line?
Use docker container inspect
to view the NetworkMode
attribute of the container:
docker container inspect <container> --format '{{ .HostConfig.NetworkMode }}'
This will either be:
host
when running with --net=host
none
when running with --net=none
default
when using the default bridge networkcontainer:<id>
when using the namespace of another container