
Start with docker ps for running containers and docker ps -a for every container. Then use docker inspect, docker port, and docker stats when you need configuration, networking, or resource details.
List running containers
docker psCheck the STATUS, PORTS, and NAMES columns. A status such as Up 2 minutes means the main process is running.
List all containers
docker ps -aThis includes stopped and exited containers. An Exited (1) status means the process ended with exit code 1; check its logs next.
Inspect container configuration
docker inspect my-containerThis prints JSON containing the image, environment, mounts, networks, restart policy, and state. Use it when a container behaves differently from your Compose file or docker run command.
Check published ports
docker port my-containerThis shows how container ports map to host ports. If the output is empty, the container may be running without a published host port.
View live CPU and memory usage
docker stats
docker stats --no-stream my-containerThe first command continuously streams usage for running containers. The second prints one sample for a specific container. Press Ctrl+C to stop a live stream.
See processes inside a container
docker top my-containerThis lists processes visible inside the container. It is useful when the container is running but the expected application process is missing.
Check a Compose application
docker compose ps
docker compose configRun these from the folder containing the Compose file. ps shows service status; config validates and renders the resolved configuration.
A quick checking routine
- Run
docker ps -a. - Check logs if the status is
Exited. - Check ports with
docker port. - Inspect mounts and environment variables with
docker inspect. - Check resource pressure with
docker stats.
Next steps
For application output, use docker logs. For the official command details, see Docker’s container CLI reference and stats reference.