Docker
/Beginner
docker ps
Definition
The CLI command that outputs a list of currently running containers, showing their IDs, image names, uptime, and mapped ports.
Explain Like I'm New
The Task Manager for Docker. It shows you exactly what containers are currently turned on and running on your computer.
Real World Example
You start a database but forget which port you assigned it to. You type `docker ps`, look at the port column, and see it is running on port 5432.
Common Use Cases
- •Monitoring state
- •Finding Container IDs
Crucial Command Flags
| Flag / Option | Description |
|---|---|
| -a / --all | Show all containers (default shows just running). |
| -q / --quiet | Only display container IDs (useful for piping to other commands). |
| -s / --size | Display the total file sizes. |
Interview Questions
basic
- Will `docker ps` show you containers that are currently Stopped/Exited?
intermediate
- Why is it called `ps`?