Space Container Inspection

DockerDockerBeginner
Practice Now

Introduction

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.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL docker(("`Docker`")) -.-> docker/ContainerOperationsGroup(["`Container Operations`"]) docker/ContainerOperationsGroup -.-> docker/inspect("`Inspect Container`") subgraph Lab Skills docker/inspect -.-> lab-268700{{"`Space Container Inspection`"}} end

Explore Container Information

In this step, you will learn how to inspect a Docker container to retrieve detailed information about it.

  1. 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"
  2. 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.

  1. Firstly, connect to a sample network using the following command:

    docker network create my_network
  2. 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
  3. 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.

Other Docker Tutorials you may like