Docker Commands
Table of Contents
Basic listing and status
docker ps— running containersdocker ps -a— all containers (including stopped)docker stats— live CPU/memory/network/IO usagedocker stats --no-stream— one-shot snapshot
Detailed inspection
docker inspect <container>— full JSON config, state, network, mountsdocker inspect -f '' <container>— extract a single field via Go templatedocker inspect -f '' <container>— get IPdocker inspect -f '' <container>— environment variablesdocker inspect -f '' <container>— host PID of main process
Logs
docker logs <container>— stdout/stderrdocker logs -f <container>— followdocker logs --tail 100 <container>— last N linesdocker logs --since 10m <container>— time-filtered
Processes and runtime
docker top <container>— running processes inside the containerdocker port <container>— port mappingsdocker diff <container>— filesystem changes vs imagedocker exec -it <container> sh— interactive shell (orbash)docker exec <container> ps aux— run a command without a shell session
Resource and filesystem
docker cp <container>:/path ./local— copy files out for inspectiondocker inspect -f '' <container>— memory limitdocker inspect -f '->\n' <container>— mounts
Events and history
docker events --filter container=<container>— real-time lifecycle eventsdocker container inspect --size <container>— include writable-layer size (SizeRw,SizeRootFs)
Image provenance
docker inspect -f '' <container>— image IDdocker history <image>— layer history