docker ps vs docker images — What They Show
Fast recall
Quick revision
Core answer
Interview-ready guide
Interview answer
So docker images and docker ps show you two completely different things.
When you run docker images, you're looking at all the blueprints stored on your local machine — the image templates you've either built yourself or pulled from a registry like Docker Hub. You'll see columns like REPOSITORY, which is the image name, TAG for the version, and SIZE showing how much disk space it takes. It's like looking at a list of JAR files sitting in your Maven local repository.
On the other hand, docker ps shows you the containers that are actually running right now. These are live processes using CPU and memory. You'll see CONTAINER ID, which is a unique identifier for that running instance, IMAGE showing which blueprint it came from, STATUS like Up 2 hours, and PORTS showing network mappings like host port 8080 forwarding to container port 8080.
Here's a key thing freshers miss: docker ps only shows running containers by default. If you start a Spring Boot container and it crashes immediately, docker ps shows nothing. You need docker ps -a to see all containers including stopped or exited ones.
That -a flag is critical for debugging because it reveals containers that failed to start. So remember: docker images for blueprints on disk, docker ps for live processes, docker ps -a to see everything including the dead ones.
docker ps vs docker images — What They Show
Direct Answer
The docker images command lists all Docker images stored on your local machine — these are the blueprints. The docker ps command lists currently running containers — these are the live instances. Use docker ps -a to see all containers including stopped ones. They're different because images are static templates while containers are active processes.
Code Example
# docker images -> the read-only blueprints stored on disk
docker images
# REPOSITORY TAG IMAGE ID SIZE
# order-service 1.0 a1b2c3d4e5f6 210MB
# docker ps -> containers running RIGHT NOW
docker ps
# CONTAINER ID IMAGE STATUS PORTS
# 9f8e7d6c5b4a order-service:1.0 Up 3 minutes 0.0.0.0:8080->8080/tcp
# docker ps -a -> include stopped/exited containers (key for debugging)
docker ps -a
# 1a2b3c4d5e6f order-service:1.0 Exited (1) 2 minutes ago
Common Mistakes & Pitfalls
- Not using -a flag: Freshers run docker ps, see no output, and think Docker isn't working — but their container started and immediately exited with an error. Running docker ps -a reveals the stopped container with STATUS showing Exited (1) 2 minutes ago, and docker logs shows the stack trace.
- Confusing IMAGE ID in docker ps: The IMAGE column in docker ps output shows the image name or ID the container was created from, not a unique container identifier — that's the CONTAINER ID column. Multiple containers can show the same IMAGE value because they're all instances of the same blueprint.
- Forgetting containers persist after stopping: Stopping a container with docker stop doesn't delete it. The container still exists in a stopped state (visible with docker ps -a), consuming disk space. Freshers often run docker run repeatedly, creating dozens of stopped containers without realizing it, until docker ps -a shows a huge list. The fix is docker rm or using the --rm flag on docker run to auto-delete on exit.
Check your understanding
Answer these without looking back at the article.
- How do you remove stopped containers and unused images?
- What does the PORTS column in docker ps show?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.