What does the 'docker inspect' command do?

0192

The docker inspect command is used to retrieve detailed information about Docker objects, such as containers, images, networks, and volumes. When you run this command, it outputs a JSON array containing various attributes and settings related to the specified object.

For example, when inspecting a container, you can obtain information such as:

  • Configuration settings (e.g., environment variables, command, entry point)
  • Networking details (e.g., IP address, port mappings)
  • State information (e.g., running status, exit code)
  • Mount points and volumes

You can also use filters with the docker inspect command to extract specific information. For instance, to get the IP address of a container, you can use:

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_name>

This command allows you to focus on the data you need without having to sift through the entire JSON output.

0 Comments

no data
Be the first to share your comment!