Docker How To Inspect Container
Inspecting a container is easy.
Lets assuem that you have a container named inspiring_dhawan.
You can inspect a container like this:
docker inspect inspiring_dhawan
The above will give you a huge amount of output formatted as JSON. This will tell you almost anything you want to know about a running container. You can actually filter out specific information that you might need with the “–format” parameter.
The following will give you the IP address of a continer.
docker inspect --format='{{ .NetworkSettings.IPAddress }}' inspiring_dhawan
You can check a containers hostname like this:
docker inspect --format='{{ .Config.Hostname }}'
You could list the volumes used by a container like this:
docker inspect -f '{{ .Mounts }}' containerid
Get a shell on a running container so that you can run any commands that you want and examine it in any way you want:
docker exec -it inspiring_dhawan bash