Published: July 22, 2026
Read: 9 min
In: Technology & Development

Written by

Reviewed by

Last updated: July 26, 2023

Expert verified

SVG Image

TL;DR

To list docker containers in Linux, you can try these methods:

  1. Listing Running Containers: Get a quick overview of running containers with essential information like Container ID, Names, Status, and Ports using docker ps command.
  2. Displaying Container Details: Inspecting Containers: Access detailed container information in JSON format by using docker inspect <container_name_or_id>.
  3. Filtering Containers by Criteria: Focus on specific containers based on criteria like status=running with docker ps –filter status=running.
  4. Sorting and Formatting Output: Customize listing output with specific details using docker ps --format "ID: {{.ID}}\tName: {{.Names}}\tStatus: {{.Status}}".
  5. Listing Stopped Containers: Cleanup and Maintenance: Identify and remove stopped containers to free up resources with docker ps -a --filter status=exited.

Listing Docker containers may seem straightforward, but it comes with challenges. Be mindful of common errors like “No Containers Listed,” “Access Denied,” “Unable to Connect to Docker Daemon,” “Container Names vs. Container IDs,” and “Incorrect Filter Syntax.” By familiarizing yourself with these issues, you can navigate Docker more effectively and enhance your container management skills.

Read the guide below to learn different methods to list docker containers in Linux and common errors that can occur during the process.

Docker containers have revolutionized the world of software development, enabling developers to package applications with all their dependencies and run them in isolated environments. Managing these containers efficiently is crucial for ensuring smooth operations and optimal resource utilization. In this comprehensive guide, I will explore different methods to list docker containers in Linux and common errors that can occur while listing containers.

How to List Docker Containers in Linux

To list Docker containers in Linux effectively, use methods like Listing Running Containers for a quick overview, Displaying Container Details for in-depth insights, Filtering Containers by Criteria for focused results, Sorting and Formatting Output for customization, and Listing Stopped Containers for cleanup. 

1. Listing Running Containers

When you need a quick overview of all the running containers on your system, listing running containers is the way to go. It helps you monitor active containers and provides essential information like Container ID, Names, Status, and exposed Ports, ensuring efficient management of your containerized applications. Follow these steps:

  1. Open your Terminal window.
opening terminal 38
  1. Enter the following command:

<strong>docker ps</strong>
  1. This command will display essential information about each running container, including its Container ID, Names, Status, and exposed Ports.
listing docker containers

2. Displaying Container Details

Sometimes, you may need more detailed information about a specific container. By using the docker inspect command with the Container ID or Name, you can access a JSON representation of the container’s configuration and network settings, aiding in troubleshooting and debugging tasks. To inspect a container, do the following:

  1. In your command prompt, use the docker inspect command, followed by the Container ID or Name:

<strong>docker inspect container_name_or_id</strong>
  1. The output will provide a JSON representation of the container’s configuration, network settings, and more.
getting detailed info about specific container 1

3. Filtering Containers by Criteria

Filtering containers can be incredibly useful when you want to focus on specific containers based on certain criteria. It allows you to focus on relevant containers, such as running or stopped ones, and filter by names or other properties, facilitating effective monitoring and management. Here’s how you can do it:

  1. Launch your Terminal, use the docker ps command with the --filter flag and the desired filter, such as status=running:

<strong>docker ps --filter status=running</strong>
  1. This will display a list of containers that are currently running.
filtering containers to list only running ones

4. Sorting and Formatting Output

Customizing the output of your container listing can make it easier to read and focus on specific details. By using the –format flag with a custom Go template, you can display specific container details like Container ID, Name, and Status, making the output more concise and tailored to your needs. Here’s how you can do it:

  1. Enter your command window and type the following command:

<strong>docker ps --format "ID: {{.ID}}\tName: {{.Names}}\tStatus: {{.Status}}"</strong>
  1. This will format the output to display only the specified information for each container, making it more readable and concise.
listing containers info in customized format

5. Listing Stopped Containers: Cleanup and Maintenance

Over time, you may accumulate stopped containers that are no longer needed, consuming valuable resources. Listing stopped containers can help you identify and clean them up efficiently. Follow these steps:

  1. Open your Terminal and enter the following command: