Serverspace Black Friday
DF
September 5, 2023
Updated September 4, 2023

Docker Container Listing

Docker FAQ Linux

Docker is a platform, based on open source, that automatizes the process of deploying, scaling, and managing applications by utilizing containerization. Through Docker containers, developers can bundle applications and their dependencies into a single unit that can be executed on any Docker-supported platform. When working with Docker containers, it's valuable to have information about actively starting containers and ports they utilize. The command "docker ps" is employed for this specific purpose. Let's delve deeper into this command.

Discover command syntax:

docker ps [OPTIONS]

Options:

  • **-a, --all**: List all containers, including stopped ones;
  • **-f, --filter**: Filter output using conditions;
  • **-n, --last N**: Show only the N most recently created containers;
  • **-q, --quiet**: Print container IDs only;
  • **-s, --size**: Print container sizes (including all mounted volumes);
  • **--format**: Set output format;
  • **--no-trunc**: Do not truncate output (show all information).

Examples of usage

Display a list of all the currently active containers:

docker ps
containerize
Screenshot №1. Show all containers

Retrieve a comprehensive list of all containers, including both those that are currently running and those that have been stopped:

docker ps -a
Show all include stopped
Screenshot №2. Show all include stopped

Print container IDs:

docker ps -q

Show details about the most recently created 5 containers:

docker ps -n 5

Display information about containers with certain filters. For example, named "webapp":

docker ps -f name=webapp

Show the sizes of the containers:

docker ps -s
Display size of containers
Screenshot №3. Display size of containers

Output information about containers in a specific format. To illustrate, to only showcase the identifiers and names of the containers:

docker ps --format "{{.ID}} {{.Names}}"
Show info about containers in specific view
Screenshot №4. Show info about containers in specific view

Thus, the "docker ps" command is a powerful tool for displaying information about Docker containers. By utilizing this feature, you can obtain a comprehensive summary of the existing container status and effortlessly sort the output by diverse parameters.

Vote:
4 out of 5
Аverage rating : 4
Rated by: 1
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.