1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/docker-ps.md

37 lines
1 KiB
Markdown
Raw Normal View History

2020-09-08 13:19:52 -03:00
# docker ps
> List Docker containers.
> More information: <https://docs.docker.com/reference/cli/docker/container/ls/>.
2020-09-08 13:19:52 -03:00
- List currently running Docker containers:
2020-09-08 13:19:52 -03:00
`docker ps`
- List all Docker containers (running and stopped):
2020-09-08 13:19:52 -03:00
`docker ps {{[-a|--all]}}`
2020-09-08 13:19:52 -03:00
- Show the latest created container (includes all states):
`docker ps {{[-l|--latest]}}`
2020-09-08 13:19:52 -03:00
- Filter containers that contain a substring in their name:
`docker ps {{[-f|--filter]}} "name={{name}}"`
2020-09-08 13:19:52 -03:00
- Filter containers that share a given image as an ancestor:
`docker ps {{[-f|--filter]}} "ancestor={{image}}:{{tag}}"`
2020-09-08 13:19:52 -03:00
- Filter containers by exit status code:
`docker ps {{[-a|--all]}} {{[-f|--filter]}} "exited={{code}}"`
2020-09-08 13:19:52 -03:00
- Filter containers by status (created, running, removing, paused, exited and dead):
`docker ps {{[-f|--filter]}} "status={{status}}"`
2020-09-08 13:19:52 -03:00
- Filter containers that mount a specific volume or have a volume mounted in a specific path:
`docker ps {{[-f|--filter]}} "volume={{path/to/directory}}" --format "table {{.ID}}\t{{.Image}}\t{{.Names}}\t{{.Mounts}}"`