Since I don't want to explain what these data structures are, instead of using those terms, I'll use JSON terms to make it more understandable. That's why go templates actually work with go data types. Internally JSONs are represented using various Go data structures. Use the docker version command on the client to check your client and daemon API versions. API 1.21+ The client and daemon API must both be at least 1.21 to use this command. This article is not going to be about go-templates, but if you want to learn more, you can read about it here. Display detailed information on one or more networks. inspect is already there, and it is very powerful.ĭocker uses go-templates to format its output. The problem with jq is that it doesn't come preinstalled in most of the Linux distributions, while the default formatting mechanism of docker. So if you're experienced in jq, you might want to just use it. Inspect provides us with a JSON array for the output, which you can filter using something like jq. geekflaregeekflare: docker network inspect geekflarenetwork. This network won’t be running determineddubinsky container anymore the container field will be empty. You need to mention the network name and the container name in disconnect command.
Objective_jones -> 172.21.0.4/16 Formatting the output of Docker inspect command To disconnect the network from the container, run the command below.
The main strength of inspect comes from its formatting capabilities.įor example, you can extract the IP address of a running container by inspecting it, and formatting in a specific way. In case you were wondering, Docker objects or resources are simply things like containers, volumes, networks etc.
It lets you extract information about various docker objects, knowing how to use it is something EVERYONE should know about. One of the essential Docker commands is docker inspect.