EN
Docker - list only container ids
7 points
In this short article, we would like to show how to list ids of run containers in Docker.
Quick solution (run following command):
xxxxxxxxxx
1
docker ps -q
Output:
xxxxxxxxxx
1
d76423e8e259
2
f44b6ffcee6a
3
25605bf8dc3f
4
c14692b929b2
5
8867d0ac1ed1
6
252ab6485893
The approach presented in the section cuts first field that is Container ID and removes column heading.
Command example:
xxxxxxxxxx
1
docker ps | cut -f 1 -d " " | tail -n +2
Output:
xxxxxxxxxx
1
d76423e8e259
2
f44b6ffcee6a
3
25605bf8dc3f
4
c14692b929b2
5
8867d0ac1ed1
6
252ab6485893