Introduction
This article covers the following tech skills:
In this lab, you will be transported to a futuristic space city where you take on the role of a space police officer. Your mission is to inspect and investigate suspicious Docker containers that might be posing security threats within the space city.
Explore Container Information
In this step, you will learn how to inspect a Docker container to retrieve detailed information about it.
- Start by running a Docker image as a container:
docker run -d --name my_container alpine sh -c "while true; do echo hello world; sleep 1; done"
- Next, inspect the created container to retrieve its details:
docker inspect my_container
This command will provide a comprehensive JSON output containing information about the container, such as its configuration, network settings, and mounts.
Examine Container Networks
In this step, you will delve into the networking details of a Docker container.
- Firstly, connect to a sample network using the following command:
docker network create my_network
- Then, launch a new container and connect it to the created network:
docker run -d --name my_network_container --network my_network alpine sleep 1d
- Now, inspect the network configuration to obtain network-specific information:
docker network inspect my_network
This will provide a detailed breakdown of the network, including its subnets, containers connected, and other relevant details.
Summary
In this lab, you have simulated the role of a space police officer and explored the docker inspect
command to gather crucial information about Docker containers. By inspecting container and network configurations, you have gained insights into their internal workings, thus enhancing your Docker proficiency.
🚀 Practice Now: Space Container Inspection
Want to Learn More?
- 🌳 Learn the latest Docker Skill Trees
- 📖 Read More Docker Tutorials
- 💬 Join our Discord or tweet us @WeAreLabEx
Top comments (0)