📝 Edit page
➕ Add page
Manage containers
See also the Run containers cheatsheet.
List
- Show all running containers:
$ docker ps - Show running and stopped containers with the
-a, --allflag:$ docker ps -a - Show a specific container:
$ docker ps -a --filter 'name=my-app' - Show just IDs with
--quiet. Useful for chaining commands.$ docker ps -q
View
- Check Linux version.
$ docker run node:12-slim \ cat /etc/issue - See containers logs (recommended).
$ docker logs -f my-app
Stop and remove container
- Stop a running container:
$ docker stop my-app - Stop all running containers. This uses
--quietflag return only the container IDs.$ docker stop $(docker ps -q) - Remove a container (must be stopped first).
$ docker rm my-app - Remove all containers.
$ docker rm -f $(docker ps -a -q)Or
$ docker ps -q | xargs docker rm