0
0
Dockerdevops~15 mins

Inspecting container details in Docker - Mini Project: Build & Apply

Choose your learning style9 modes available
Inspecting container details
📖 Scenario: You are working with Docker containers on your local machine. You want to learn how to check details about running containers to understand their status and configuration.
🎯 Goal: Learn how to list running Docker containers, identify a container by its name, and inspect detailed information about that container.
📋 What You'll Learn
Use the docker ps command to list running containers
Identify the container name from the list
Use the docker inspect <container_name> command to view detailed container information
💡 Why This Matters
🌍 Real World
Inspecting container details helps you understand how your applications run inside Docker containers and troubleshoot issues.
💼 Career
Knowing how to inspect containers is essential for DevOps roles to monitor, debug, and manage containerized applications.
Progress0 / 4 steps
1
List running Docker containers
Run the command docker ps to list all running Docker containers on your machine.
Docker
Need a hint?

Use docker ps to see running containers.

2
Identify a container name
From the output of docker ps, find the exact container name you want to inspect. Assign this name as a string to a variable called container_name in your shell or script.
Docker
Need a hint?

Look at the last column in docker ps output for the container name. Use that exact name in container_name.

3
Inspect the container details
Use the command docker inspect $container_name to get detailed information about the container stored in the variable container_name.
Docker
Need a hint?

Use docker inspect $container_name to see detailed info.

4
Display container's IP address
From the output of docker inspect $container_name, extract and display only the container's IP address using the command docker inspect -f '{{ .NetworkSettings.IPAddress }}' $container_name.
Docker
Need a hint?

Use the -f flag with docker inspect and the Go template {{ .NetworkSettings.Networks.bridge.IPAddress }} to get the IP address.