A WIP collection of docker commands for maintaining services running on subdomains and limited disk space while I experiment. I still don’t know what docker really is.
container cleanup
Source: https://docs.docker.com/engine/manage-resources/pruning/
clean up all images that don’t have at least one container associated with them
docker image prune -aclean up all stopped docker containers
docker container pruneclean up all anonymous docker volumes not used by at least one container
docker volume pruneclean up all custom docker networks not used by at least one container
docker network pruneall of the above (just use this command)
docker system pruneinformation
break down container usage (-v for more info)
docker system df [-v]another way to show disk usage
docker ps --sizeshow running containers (-a flag shows all running containers)
docker ps [-a]another way to show containers
docker container lslogs
start with last 10 log entries and follow log output (think tail -f)
docker compose logs -f -n 10script to update docker containers
# ~/.local/bin/dockerpull
#!/bin/bash
dockerdir="/home/user/docker"
for dir in $(ls $dockerdir); do
cd "$dockerdir/$dir"
docker compose pull && docker compose up -d
donecrontab file
- must be run as root
# every Sunday at 12am run dockerpull script
0 0 * * 7 /home/user/.local/bin/dockerpullEOF