Inspecting containers
Containers are runtime instances of an image and have a lot of associated data that characterizes their behavior. To get more information about a specific container, we can use the inspect
command. As usual, we have to provide either the container ID or the name to identify the container for which we want to obtain the data. So, let’s inspect our sample container. First, if it is not already running, we have to run it:
$ docker container run --name trivia fundamentalsofdocker/ trivia:ed2
Then, use this command to inspect it:
$ docker container inspect trivia
The response is a big JSON object full of details. It looks similar to this:
Figure 3.8 – Inspecting the trivia container
Note that the preceding screenshot only shows the first part of a much longer output.
Please take a moment to analyze what you have. You should see information such as the following:
- The ID of the container
- The creation...