Docker Cheatsheet


Delete all images for i in `docker images | awk 'NR>1{print $1":"$2}'`;do docker rmi $i;done Aliyun docker accelerator /etc/docker/daemon.json {"registry-mirrors": [""]}

If you using Dockerfile, you should know about caching for faster builds. Sometimes, you need to rebuild without cache. you can run docker build with --no-cache option that will disable all layer cache. There is problem when you should use some Dockerfile commands like ADD or COPY to copy file form host to container. You need to copy new file to container then rebuild again without change any line of Dockerfile but the new file not was copy to container.

Read More…

Symptom When try to delete container, it failed to remove and reportd below error: Error response from daemon: driver "overlay" failed to remove root filesystem for c9cb...0542: remove /var/lib/docker/overlay/81df...3026/merged: device or resource busy Solution Find out which process has mounted this busy mountpoint: /var/lib/docker/overlay/81dfae6c47d7919e91acb3947d2c2093d2e3549e16099279852796c7251d3026/merged $ sudo find /proc -maxdepth 2 -type f -name "mountinfo" -exec grep -nl 81dfae6c47d {} \; /proc/23512/mountinfo /proc/23513/mountinfo /proc/23610/mountinfo /proc/23612/mountinfo Check what’s the process according to above PID

Read More…