Docker tips

Use docker in docker to drive docker from a container
Working under windows, sometimes docker slow down. Sometimes you need to access to the MobyVM.
With this line:

docker run --rm  -ti -v "/var/run/docker.sock:/var/run/docker.sock" -v /:/host   docker  sh

you run a container which will removed upon exit. This container can access to docker daemon (via the docker in docker image) and has also access to MobyVM under the /host mount point.
Keep in mind this container has total access to your windows C: disk too, so be careful!
Find the total memory % used by your containers:

docker stats --no-stream --format "table {{.MemPerc}}" | sed 's/[A-Za-z]*//g' | awk '{sum += $1} END {print sum "%"}'

Tested with 18.06.1-ce, take a look at for docker stats syntax

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.