Skip to content

Instantly share code, notes, and snippets.

@ipeluffo
Last active May 28, 2019 09:01
Show Gist options
  • Save ipeluffo/035fd70b11b6c3464c3da4bd13e7443c to your computer and use it in GitHub Desktop.
Save ipeluffo/035fd70b11b6c3464c3da4bd13e7443c to your computer and use it in GitHub Desktop.
Docker commands reference

Docker cheat sheet

List all running and stopped containers

docker ps -a

List all running containers (just stating the obvious and also example use of -f filtering option)

docker ps -a -f status=running

List all running and stopped containers, showing only their container id

docker ps -aq

Remove all containers that are NOT running

docker rm `docker ps -aq -f status=exited`

link volumes with other containers by adding the --volumes-from [name] option

docker run --rm -ti --volumes-from container_data ubuntu /bin/bash

Volumes

List containers running and the attached volumes size

docker system df -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment