Skip to content

Instantly share code, notes, and snippets.

Last active Nov 30, 2016
What would you like to do?
Docker tips and tricks

Delete dangling volumes

docker volume rm $(docker volume ls -f dangling=true -q)

docker rmi $(docker images -f dangling=true -q)

Get the docker log on a systemd platform

sudo journalctl -r -b --no-pager -u docker | less
sudo journalctl -r -b --no-pager -u docker-cor | less

Enable logging for clear containers

Uncomment the following lines in /usr/bin/

#runtime_args="$runtime_args --global-log=\"$global_log\""

#runtime_args="$runtime_args --debug"

In /etc/systemd/system/docker.service.d/clr-containers.conf setup the .sh file as the runtime

ExecStart=/usr/bin/dockerd -D --add-runtime cor=/usr/bin/ --default-runtime=runc

Restart the docker service

The logs can be found at

sudo less /run/cc-oci-runtime/cc-oci-runtime.log

Delete all containers

sudo docker rm -f $(sudo docker ps -a -q)

Delete all images

sudo docker rmi $(sudo docker images -q)

Entering Network Namespace of a container

PID=$(docker inspect --format {{.State.Pid}} <containerid|name>)
nsenter --target $PID --net

Examining memory footprint

sudo smem -c "swap pss command" | grep qemu-lite

Removing all Ciao networks

docker network rm $(docker network ls --filter driver=ciao -q)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment