Docker Container Discovery Adventure

DockerDockerBeginner
Practice Now

Introduction

Welcome to the FutureTech Lab! In this lab, you will take on the role of a scientist working in a cutting-edge tech laboratory, where Docker technology plays a crucial role in managing and running software applications. Your goal is to master the docker ps command to list the running containers and understand its usage in real-world scenarios.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL docker(("`Docker`")) -.-> docker/ContainerOperationsGroup(["`Container Operations`"]) docker/ContainerOperationsGroup -.-> docker/ps("`List Running Containers`") subgraph Lab Skills docker/ps -.-> lab-268704{{"`Docker Container Discovery Adventure`"}} end

List Running Containers

In this step, you will learn how to use the docker ps command to list the running containers in your environment. The docker ps command is used to show all running containers on your system.

  1. Open a terminal in your Linux environment.

  2. Use the following command to list all the running containers:

    docker ps

    This command will display the running containers along with their details such as container ID, image, status, and ports.

Filtering Running Containers

Now, you will learn to filter the running containers based on different criteria.

  1. Use the following command to list all the running containers along with the stopped containers:

    docker ps -a

    This command will show all containers, including running and stopped ones.

  2. Use the following command to list only the running containers with specific formatting:

    docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Ports}}"

    This command will display the running containers in a specific table format.

Summary

In this lab, you have learned to use the docker ps command to list running containers and gained a better understanding of Docker container management. This knowledge will be invaluable as you continue to explore Docker and its capabilities.

Other Docker Tutorials you may like