<- Back

docker

clean up
list volumes
docker volume ls --filter driver=local --filter name="dev_" --format "{{.Name}}"
show disk usage / volume sizes
docker system df [--verbose]
prune
docker system prune [--volumes] [--all]
show stopped containers
docker container ls -f status=exited -a
stats
sort by memory usage
docker stats --no-stream --format "table {{.Name}}\t{{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" | LC_ALL=en_US.utf8 sort -k 4 -h
show restarts in the last hour
docker events --filter event=restart --since=60m
ps
Find testcontainers
docker ps --filter "label=org.testcontainers=true"
List all assigned IP addresses
docker ps -q | xargs docker inspect --format '{{.Id}};{{.Name}};{{range $key, $value := .NetworkSettings.Networks}};{{if $value.IPAddress}}{{$key}}: {{$value.IPAddress}};{{end}}{{end}}' | sed 's/;$//' | column --table --separator ';'
inspect
Health
docker inspect --format='{{json .State.Health}}' container_name
compose
run command inside container
docker-compose exec container bash
delete everything (including volumes)
docker-compose down --volumes
swarm
list nodes
docker node ls
list stacks
docker stack ls
list services
docker service ls
show errors during deployment (image not found etc.)
docker service ps --no-trunc <service_name>
drain node
docker node update --availability drain <id>
activate node
docker node update --availability active <id>
logs
docker service logs --since=30m -f <service_name>