Quick Docker SSH commands

These commands I don’t use to often, but when i need them, I can never remember off the top of my head and end up spending to much time searching for them. So I keep them here for a quick reference.

#ssh into container:
docker exec -it <container name> /bin/bash
#Shows container stats in real time:
docker stats --all --format "table {{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}"
#Update all images:
docker images | awk '{print $1}' | grep -v 'none' | grep -iv 'repo' | xargs -n1 docker pull

#Remove all dead volumes, brute force.
docker volume rm $(docker volume ls -qf dangling=true)
docker volume ls -qf dangling=true | xargs -r docker volume rm
docker system prune -a --volumes
Follow
( 1 Followers )
X

Follow

E-mail : *

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.