- Collection of commands/scripts for Docker. Listed below are commands I frequently use but often forget the exact syntax for.
- Link to my Linux repo - https://github.com/chrnnk/linux
- Script to install Docker on Linux - https://github.com/chrnnk/linux/tree/main/docker-install
Available commands: start stop restart pause logs
docker [command] [containername]
Show running containers
docker ps
Show docker stats, cpu mem net storage
docker stats
Docker size commands
docker system df
docker ps --size
sudo du -h $(docker inspect --format='{{.LogPath}}' $(docker ps -qa)) | sort -hr
Pull all new images
docker images | awk '{print $1":"$2}' | grep -v REPOSITORY | xargs -L1 docker pull
Stop all containers
docker stop $(docker ps -q)
Restart all containers
docker restart $(docker ps -aq)
Print all container names:
docker ps --format ‘{{.Names}}’
Print all container images:
docker ps --format ‘{{.Image}}’
Cleanup docker images
docker image prune -a
Cleanup docker volumes
docker system prune --volumes
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/red5d/docker-autocompose CONTAINERNAME >> CONTAINERNAME.yml