How to List Containers in Docker

TLDR
Use docker ps to list running containers, and docker ps -a to see all containers, including those that have exited. Add filters or formatting for more targeted results.
Prerequisites
- Docker installed (any recent version)
- Terminal access
Listing Running Containers
To see all containers currently running on your system, use:
# List running containers
docker ps
This shows container IDs, names, images, and status. It's helpful for quickly checking what's active.
Listing All Containers (Including Stopped)
If you want to see containers that have exited or stopped, add the -a flag:
# List all containers, including stopped ones
docker ps -a
This is useful for troubleshooting or cleaning up old containers.
Filtering and Formatting Output
You can filter containers by status or name, and format the output for scripts or reports.
# Show only exited containers
docker ps -a --filter status=exited
# Show containers with a specific name
docker ps -a --filter "name=webapp"
# Custom columns for easier reading
docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Status}}"
Next Steps
Try combining these commands with docker stop, docker start, or docker rm to manage your containers more efficiently.
Good luck with your project!
Related Resources
- Docker Run vs Docker Start: container lifecycle commands
- Remove Old Docker Containers: clean up stopped containers
- Docker Name Already in Use: resolve naming conflicts
- Introduction to Docker Guide: Docker fundamentals
- Docker Quiz: test your knowledge
Try it hands-on
Run the commands from this article in the browser. Nothing to install.
Docker Terminal Simulator
Practice Docker commands in an interactive browser terminal. Learn images, containers, logs, exec, Dockerfile builds, volumes, networks, and Docker Compose with a live Docker daemon visualization.
How Docker Works Under the Hood
Watch what really happens when you run docker run -p 8080:80 nginx, one layer at a time. Step down the whole stack: the CLI, the daemon, the registry pull, containerd, the OCI runtime bundle, runc, the running container, and the shared Linux kernel. Every stage shows the real low-level command you can run yourself, so it doubles as a tour of the primitives that make a container: namespaces, cgroups, and runc. A container is not a small VM, and this shows you why.
We earn commissions when you shop through the links below.
Svix
Webhooks as a service
Svix Dispatch sends your webhooks for you: retries with exponential backoff, signed payloads, idempotency keys, and a delivery log your customers can see.
DigitalOcean
Cloud infrastructure for developers
Simple, reliable cloud computing designed for developers
DevDojo
Developer community & tools
Join a community of developers sharing knowledge and tools
SMTPfast
Developer-first email API
Send transactional and marketing email through a clean REST API. Detailed logs, webhooks, and embeddable signup forms in one dashboard.
QuizAPI
Developer-first quiz platform
Build, generate, and embed quizzes with a powerful REST API. AI-powered question generation and live multiplayer.
Want to support DevOps Daily and reach thousands of developers?
Become a SponsorFound an issue?
Related Posts
Also worth your time on this topic
5 Advanced Docker Features Worth Knowing
Go beyond Docker basics with BuildKit, multi-stage builds, health checks, init processes, and build secrets. Learn practical techniques that improve security, performance, and reliability.
Docker Security Hardening Checklist
Comprehensive security checklist for hardening Docker containers, images, and runtime environments.
60-90 minutes
Running Docker Containers on Your Linux Server
Install Docker and Docker Compose on Ubuntu, run your first container, deploy a WordPress stack with docker-compose, and set up Nginx as a reverse proxy in front of your containers.
60 minutes