Show pagesourceBack to top Share via Share via... Twitter LinkedIn Telegram Yammer RedditRecent ChangesSend via e-MailPrintPermalink × Table of Contents file locations Tools Useful containers useful commands Storage Free up space Identify space wasters in overlay2 directory prune images show all mounted directories Backup / restore MySQL DB Host OS Minimalist Docker-only/-centric caveats bind mounts & SELinux Troubleshooting mysql/mariadb doesn't work after I pulled a new image Resources Articles setups / howtos Docker see also: Docker Compose / Docker Swarm file locations /var/lib/docker/volumes Volumes Tools ctop – top like tool for container metrics. Useful containers Automated Nginx Proxy jwilder/nginx-proxy Automated Nginx Letsencrypt Companion jrcs/letsencrypt-nginx-proxy-companion Nextcloud nextcloud TCP Proxy tecnativa/docker-tcp-proxy UDP Proxy instantlinux/udp-nginx-proxy PostgreSQL postgres useful commands Start interactive shell in container docker exec -ti container sh List stopped containers docker ps --filter "status=exited" Get command used to start a Docker container docker inspect -f '{{json .Config}}' CONTAINERID | jq '.Env' Get IP of a container docker inspect --format '{{ .NetworkSettings.IPAddress }}' CONTAINERID Storage Free up space docker system prune -a WARNING! This will remove: - all stopped containers - all volumes not used by at least one container - all images without at least one container associated to them Are you sure you want to continue? [y/N] y Identify space wasters in overlay2 directory du -t 100M -shc /var/lib/docker/overlay2/*/diff | sort (source) Further reading: Docker garbage collector cronjob https://stackoverflow.com/questions/46672001/is-it-safe-to-clean-docker-overlay2 https://docs.docker.com/config/pruning/ prune images # delete all volumes not in use or dangling docker volume rm $(docker volume ls -qf dangling=true) # same docker system prune --all --volumes --force show all mounted directories docker inspect -f '{{ range .Mounts }}{{ .Source }}:{{ .Destination }} {{ end }}' $(docker-compose ps -q) Backup / restore Bivac - backup container volumes using Restic MySQL DB # Backup docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql # Restore cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE Host OS Which Host OS is best? Minimalist Docker-only/-centric see also: The New Minimalist Operating Systems (blog.docker.com) Rancher Project Atomic CoreOS Snappy Ubuntu Core caveats bind mounts & SELinux to be able to access mounts with enabled SELinux, you need to specify :z or :Z to the bind mount option. See also: https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label Troubleshooting mysql/mariadb doesn't work after I pulled a new image docker exec CONTAINERNAME mysql_upgrade "-uroot" "-pROOTPASSWORD" Resources Articles Tiny Docker Pieces, Loosely Joined (data-only Docker containers) Understanding how uid and gid work in Docker containers setups / howtos http://jonaskunze.com/restrict-user-to-its-own-container-using-docker/ https://github.com/rootless-containers/runrootless https://www.jujens.eu/posts/en/2018/Feb/25/multiple-docker/ Last modified: 2023-03-23 21:29