Languages
[Edit]
EN

Docker - list only container ids

4 points
Created by:
Violet-Hoffman
322

In this short article we would like to show how to list ids of run containers in Docker.

Quick solution (run following command):

docker ps -q

Output:

d76423e8e259
f44b6ffcee6a
25605bf8dc3f
c14692b929b2
8867d0ac1ed1
252ab6485893

Alternative solution

The approach presented in the section cuts first field that is Container ID and removes column heading.

Command example:

docker ps | cut -f 1 -d " " | tail -n +2

Output:

d76423e8e259
f44b6ffcee6a
25605bf8dc3f
c14692b929b2
8867d0ac1ed1
252ab6485893

Docker - useful wiki posts

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join