Docker CLI Cheat-Sheet

Published: 2021-08-05 09:58:25 +0000
Categories: Misc,




Docker is everywhere.... It's syntax is fairly simple, but sometimes you need a small prompt, this page is that prompt


# Run an image
docker run influxdb:2.0

# Run an image and pass an environment var
docker run -e MY_VAR=foo influxdb:2.0

# Run an image and mount a volume
docker run -v influx:/var/lib/influxdb2 influxdb:2.0

# Run an image and map a port to a port on the container
docker run -p 8086:8086 -v influx:/var/lib/influxdb2 influxdb:2.0

# List running processes
docker ps

# List running containers
docker list

# List all containers
docker container list -a

# Shell into a container
docker ps # get it's container ID
docker exec -t -i $container_id bash

# Kill a running container
docker kill $container_id

# Remove a container
docker container rm $container_id

# Remove all stopped containers (use with extreme caution)
docker container prune

# List volumes
docker volume list

# Remove volume
docker volume rm $volume_name

# Remove all unused volumes 
docker volume prune


docker, cheatsheet, containers,

Latest Posts

Copyright © 2021 Ben Tasker | Sitemap | Privacy Policy
Available at and http://phecoopwm6x7azx26ctuqcp6673bbqkrqfeoiz2wwk36sady5tqbdpqd.onion