Docker List Running Containers

DockerDockerBeginner
Practice Now

Introduction

Welcome to the future spaceport, where space shuttles from various galaxies land and depart. As the spaceport administrator, your responsibility is to oversee the flow of containers on the docking platforms to ensure smooth operations.

The goal of this lab is to familiarize you with the docker ps command, which is used to list the containers that are currently running on the spaceport. By the end of this lab, you will be able to identify and understand the running containers on the spaceport's platforms.


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-271483{{"`Docker List Running Containers`"}} end

Listing Running Containers

In this step, you will use the docker ps command to list the running containers on the spaceport's platforms.

  1. In your zsh terminal, execute the following command to list the running containers:

    docker ps
  2. The output should display the running containers' details, including their container ID, image, status, and other relevant information.

Filtering Running Containers by Name

In this step, you will filter the running containers and display the results based on the container name.

  1. Use the following command to filter the running containers by name, in this case, "jenkins":

    docker ps --filter "name=jenkins"
  2. The output should only display the running containers with the specified name.

Displaying All Running and Stopped Containers

In this step, you will utilize the docker ps command with additional flags to display both running and stopped containers.

  1. Execute the following command to display all containers, both running and stopped:

    docker ps -a
  2. The output should include details of all containers, regardless of their running status.

Summary

In this lab, you have learned how to use the docker ps command to list running and stopped containers, as well as filter containers based on specified criteria. This knowledge will empower you to efficiently manage and monitor containers on the spaceport platforms, ensuring smooth operations and seamless space travel. Enjoy exploring the endless possibilities of containerization in the vast universe of Docker!

Other Docker Tutorials you may like