Docker containers are like lightweight virtual machines running your applications. But how do you keep track of what’s running? Enter docker ps - your essential command for container management.
Basic Usage
The simplest form is just:
docker ps
This shows your running containers with their:
- Container ID
- Image name
- Command running inside
- Creation time
- Status
- Ports
- Names
Common Options
View All Containers
docker ps -a
Shows both running AND stopped containers. Essential for debugging or cleanup.
Show Container Sizes
docker ps -s
Adds size information to the output. Helpful for monitoring disk usage.
Custom Format
docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Status}}"
Creates a customized view showing only what you need.
Pro Tips
- 
Quick Container ID Copy docker ps -qShows only container IDs - perfect for scripting. 
- 
Filter Your View docker ps --filter "status=running" --filter "name=web"Find specific containers by status, name, or other criteria. 
- 
Latest Container docker ps -lShows only the latest created container. 
Troubleshooting Common Issues
- No Containers Showing? Check if they’re running with docker ps -a
- Too Much Output? Use formatting to show only needed columns
- Container Keeps Disappearing? Check logs with docker logs [container-id]
Best Practices
- Name your containers using --namewhen running them
- Use meaningful container names for easier identification
- Regularly clean up stopped containers with docker container prune
- Monitor container resource usage with docker stats
Beyond docker ps
While docker ps is essential, modern Docker also offers:
- docker container ls(same as- docker ps)
- docker container inspect(detailed container info)
- docker stats(resource usage)
Remember: docker ps is your first step in container management. Master it, and you’re on your way to becoming a Docker expert!