Docker tip : inspect and less

nordvpn best offer nordvpn best offer

Docker inspect and less

This isn’t so much a docker tip, as it is a jq tip. If you haven’t heard of jq, it is a great tool for parsing JSON from the command line.

This post might also interest you.

This also makes it a great tool to see what is happening in a container instead of having to use the –format specifier which I can never remember how to use exactly:

Get network information:

In this example, we will use jq to view the data returned by the inpect command.

docker inspect 4c45aea49180 | jq '.[].NetworkSettings.Networks'

Here is the result you will get.

  "bridge": {
	"EndpointID": "ba1b6efba16de99f260e0fa8892fd4685dbe2f79cba37ac0114195e9fad66075",
	"Gateway": "",
	"IPAddress": "",
	"IPPrefixLen": 16,
	"IPv6Gateway": "",
	"GlobalIPv6Address": "",
	"GlobalIPv6PrefixLen": 0,
	"MacAddress": "02:42:ac:11:00:02"

Get the arguments with which the container was started

In this one we will get the arguments

docker inspect 4c45aea49180 | jq '.[].Args'

You get these results :


Get all the mounted volumes

    "Name": "a8125ffdf6c4be1db4464345ba36b0417a18aaa3a025267596e292249ca4391f",
    "Source": "/mnt/sda1/var/lib/docker/volumes/a8125ffdf6c4be1db4464345ba36b0417a18aaa3a025267596e292249ca4391f/_data",
    "Destination": "/data",
    "Driver": "local",
    "Mode": "",
    "RW": true


As you can see, jq simplifes a lot the viewing of your json data. No more scrolling through large json.

Not only for docker, it works with other tools like Marathon, Mesos, Consul etc.

More information can be found here:


Contact Us

To order one of our services, navigate to the order service page


10 rue de Penthièvre,
75008 Paris

Email Us

hello at bright-softwares dot com

Open Hours

Monday - Friday
9:00AM - 05:00PM