Cheatsheet: Docker

docker ps –format “table {{.ID}}\t {{.Names}}\t {{.Status}}” Docker ps pretty format
docker inspect | jq ‘.[].NetworkSettings.Networks’ Get the container network settings from docker inspect with jq
docker run -ti –entrypoint=bash cassandra Overwrite entrypoint to go into the problem container for debugging
docker events Container events overview on Docker daemon
docker ps -a | less -S Nice Docker ps output
docker logs -f Continuously watch the logs
docker inspect –format ‘{{.NetworkSettings.Ports}}’ Check exposed ports on Docker container
sudo docker rm $(sudo docker ps -a -q) Remove all containers
sudo docker ps -a | grep Exited | awk ‘{ print $NF }’ | xargs sudo docker rm Remove all non-running containers
systemd-cgtop One source of information about containers resource usage
systemctl set-property docker-.scope CPUShares=512 Change the CPU shares value of specific container on the fly
docker run –rm Remove the container after it stops
docker update –cpu-shares 512 -m 300M estetic_perelman hopeful_morse Update allocated resources amount for multiple containers
docker rm -v Delete the container with all attached volumes
docker stats –all Get the all containers stats
docker image prune

docker container prune

New data management commands in Docker since 1.13 version
docker system df Overview of disk size used by Docker
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s