Daily reminder to prune your docker images every so often reddit / selfhosted ---------------------------------------------------------------------- JKLman97 · 2023-12-13 19:57 TIL this is a thing. I’m not good at docker… ---------------------------------------------------------------------- CodyEvansComputer · 2023-12-13 20:11 Thanks. "Total reclaimed space: 9.906GB" ---------------------------------------------------------------------- iBicha · 2023-12-13 20:19 Thanks for the reminder! Total reclaimed space: 29.98GB ---------------------------------------------------------------------- SpongederpSquarefap · 2023-12-13 20:28 I just have a Cron job that runs at 5am every day that does this docker system prune -a -f That will delete all dangling containers, images and networks Great for housekeeping, just be careful with it ---------------------------------------------------------------------- borkode · 2023-12-13 20:30 Saved me 200 mb on my raspberry pi, thanks! ---------------------------------------------------------------------- Bennetjs · 2023-12-13 20:31 Had servers crash because of >1TB of docker images. That command can take a while, be patient ---------------------------------------------------------------------- wolffoxfangs · 2023-12-13 20:32 almost ran this without checking to make sure its all good, looks like its safe to run! heres a link to the documentation https://docs.docker.com/engine/reference/commandline/system\_prune/ ---------------------------------------------------------------------- Cylian91460 · 2023-12-13 20:36 I don't use docker so issue a fix (systemd for life) ---------------------------------------------------------------------- Kermee · 2023-12-13 20:51 I use watchtower. Just make sure there's an environment variable `WATCHTOWER_CLEANUP` set to `true` and it does the cleanup for you. ---------------------------------------------------------------------- ccrwwwildin · 2023-12-13 20:52 https://docs.docker.com/engine/reference/commandline/system/_prune/ ---------------------------------------------------------------------- CoryCoolguy · 2023-12-13 20:52 Daily is right. I'd prefer a lower frequency. ---------------------------------------------------------------------- ccrwwwildin · 2023-12-13 20:53 [link](https://docs.docker.com/engine/reference/commandline/system/_pr une) ---------------------------------------------------------------------- Lanten101 · 2023-12-13 20:53 Watchtower environment option, WATCHTOWER_CLEANUP:True ---------------------------------------------------------------------- ORUHE33XEBQXOYLZ · 2023-12-13 20:53 My mastodon server ran out of space and keeled over because I forgot to prune 😅 ---------------------------------------------------------------------- cheesepuff1993 · 2023-12-13 20:54 This...this has saved me so much time and space... ---------------------------------------------------------------------- ARJeepGuy123 · 2023-12-13 20:59 Sweet, i reclaimed 30GB between 2 servers ---------------------------------------------------------------------- that_boi18 · 2023-12-13 21:01 Docker and systemd don't have anything to do with each other. One's a container management daemon and the other is a family of programs which includes an init system, network manager, DNS cache/resolver, etc... ---------------------------------------------------------------------- thepenis_mightier · 2023-12-13 21:02 Portainer also shows which images and volumes are unused. Pretty handy. This is good to know for those who don't use Portainer though. ---------------------------------------------------------------------- Cylian91460 · 2023-12-13 21:03 You can run service with systemd ? Did you ever use it or ? ---------------------------------------------------------------------- doomedramen · 2023-12-13 21:04 !remindme 12 hours ---------------------------------------------------------------------- RemindMeBot · 2023-12-13 21:05 I will be messaging you in 12 hours on [**2023-12-14 09:04:57 UTC**](h ttp://www.wolframalpha.com/input/?i=2023-12- 14%2009:04:57%20UTC%20To%20Local%20Time) to remind you of [**this link **](https://www.reddit.com/r/selfhosted/comments/18hp5yx/daily_reminde r_to_prune_your_docker_images_every/kd8b5n8/?context=3) [**CLICK THIS LINK**](https://www.reddit.com/message/compose/?to=Remin dMeBot&subject=Reminder&message=%5Bhttps%3A%2F%2Fwww.reddit.com%2Fr%2F selfhosted%2Fcomments%2F18hp5yx%2Fdaily_reminder_to_prune_your_docker_ images_every%2Fkd8b5n8%2F%5D%0A%0ARemindMe%21%202023-12- 14%2009%3A04%3A57%20UTC) to send a PM to also be reminded and to reduce spam. ^(Parent commenter can ) [^(delete this message to hide from others.)] (https://www.reddit.com/message/compose/?to=RemindMeBot&subject=Delete %20Comment&message=Delete%21%2018hp5yx) ***** |[^(Info)](https://www.reddit.com/r/RemindMeBot/comments/e1bko7/remind mebot_info_v21/)|[^(Custom)](https://www.reddit.com/message/compose/?t o=RemindMeBot&subject=Reminder&message=%5BLink%20or%20message%20inside %20square%20brackets%5D%0A%0ARemindMe%21%20Time%20period%20here)|[^(Yo ur Reminders)](https://www.reddit.com/message/compose/?to=RemindMeBot& subject=List%20Of%20Reminders&message=MyReminders%21)|[^(Feedback)](ht tps://www.reddit.com/message/compose/?to=Watchful1&subject=RemindMeBot %20Feedback)| |-|-|-|-| ---------------------------------------------------------------------- folta · 2023-12-13 21:06 Thanks for the suggestion! Added to crontab as well. > Total reclaimed space: 36.28GB ---------------------------------------------------------------------- Old-Assumption4984 · 2023-12-13 21:09 Thanks to the OP and thanks for making me look in depth at this, the script I was running under cron that I wrote was a bit too cautious and was leaving a lot of cruft behind. ---------------------------------------------------------------------- notdoreen · 2023-12-13 21:11 If you install Watchtower via Docker-compose, you can just add the '-cleanup' flag to delete old images every 24 hours. It will also auto update your docker containers to the latest image unless you don't want it to do that. ---------------------------------------------------------------------- Evajellyfish · 2023-12-13 21:16 This is what WatchTower is for ---------------------------------------------------------------------- bendem · 2023-12-13 21:22 I agree with you, but just because, systemd in its great vision to redo everything, can actually do containers: https://www.freedesktop.org/software/systemd/man/latest/systemd- nspawn.html ---------------------------------------------------------------------- that_boi18 · 2023-12-13 21:23 Yes? Running a service with systemd is part of its init system. Docker is an easy way to get isolated application containers running without a full fat VM. Now let me ask you, have you ever used Docker? ---------------------------------------------------------------------- Cylian91460 · 2023-12-13 21:28 Yes, systemd and docker are both used to automatically launch apps, the main difference is just the container. Which mean > Docker and systemd don't have anything to do with each other. Is false ---------------------------------------------------------------------- hdddanbrown · 2023-12-13 21:28 No its not :) ---------------------------------------------------------------------- powerexcess · 2023-12-13 21:31 Sorry but 66gb is peanuts When i docker system prune i get back 100gb at least I guess it depends on what size u have given to docker Oh and even worse: if you are on devicemapper get ready for nastier stuff. I have to kill the deamon, nuke the state, and restart - like once a month (moving us out of devmapper is up to another team) ---------------------------------------------------------------------- Evajellyfish · 2023-12-13 21:33 Then what’s it for? ---------------------------------------------------------------------- LightShadow · 2023-12-13 21:47 > Total reclaimed space: 18.32GB Not bad.. ~15 containers getting updates. ---------------------------------------------------------------------- Curious-Zucchini-256 · 2023-12-13 21:54 !Remind me 12 hours ---------------------------------------------------------------------- Curious-Zucchini-256 · 2023-12-13 21:56 !remindme 12 hours ---------------------------------------------------------------------- jarlaxle46 · 2023-12-13 21:58 Doesn't this also clears the volumes ? Or is that only with '-v' Thinking it might be a bit dangerous for containers that use volumes for databases. Like postgres. Ill read up the docs. ---------------------------------------------------------------------- bobbywaz · 2023-12-13 22:02 I was 125gb last time I did it 😭 ---------------------------------------------------------------------- readycheck1 · 2023-12-13 22:03 Wtf how? Were you running ALL the containers? ---------------------------------------------------------------------- doomedramen · 2023-12-13 22:05 Total reclaimed space: 40.8GB ---------------------------------------------------------------------- jarlaxle46 · 2023-12-13 22:07 By default, volumes are not removed to prevent important data from being deleted if there is currently no container using the volume. Use the --volumes flag when running the command to prune anonymous volumes as well: From the docs ---------------------------------------------------------------------- SpongederpSquarefap · 2023-12-13 22:13 No, it will not clean up any volumes unless you add `--volumes` to the command ---------------------------------------------------------------------- evan326 · 2023-12-13 22:15 Updating containers. ---------------------------------------------------------------------- shanebarrett123 · 2023-12-13 22:17 !remindme 18hrs ---------------------------------------------------------------------- Evajellyfish · 2023-12-13 22:18 Wow wonder what this is then: https://containrrr.dev/watchtower/arguments/#cleanup ---------------------------------------------------------------------- shanebarrett123 · 2023-12-13 22:18 !remindme 18 hours ---------------------------------------------------------------------- The_Basic_Shapes · 2023-12-13 22:21 Pardon my stupidity but this is an honest question... If docker is so awesome, why the necessary maintenance? How are these containers wasting that much space? ---------------------------------------------------------------------- liocer · 2023-12-13 22:24 This ---------------------------------------------------------------------- PM_ME_YOUR_OPCODES · 2023-12-13 22:27 Fuck I hate modern development. ---------------------------------------------------------------------- Genesis2001 · 2023-12-13 22:34 Ansible for me. Every time I rerun or deploy more docker containers, I include the following playbook at the end to clean up. --- - name: clean up docker images hosts: gather_facts: no collections: - community.docker tasks: - name: prune docker caches community.docker.docker_prune: containers: yes images: yes images_filters: dangling: false networks: yes volumes: yes builder_cache: yes If I had something like watchtower updating my containers when new ones are available, I'd install a cron instead. ---------------------------------------------------------------------- dasBaum_CH · 2023-12-13 22:51 just use cron like a pro. https://crontab.guru/#0_18_*_*_0 ---------------------------------------------------------------------- power78 · 2023-12-13 22:54 That's just an option you can add to watchtower. That doesn't mean it was designed for that one option... ---------------------------------------------------------------------- power78 · 2023-12-13 22:55 wtf... ---------------------------------------------------------------------- trisanachandler · 2023-12-13 23:03 I used to do it manually in portainer, but setup the auto prune a few weeks back. Much easier, but I use portainer for updates. ---------------------------------------------------------------------- trisanachandler · 2023-12-13 23:04 It's not the containers, it's the old container versions (images). ---------------------------------------------------------------------- trisanachandler · 2023-12-13 23:04 Why don't you like containers? ---------------------------------------------------------------------- steadystatus21 · 2023-12-13 23:19 Total reclaimed space: 74.754GB Thank you OP! ---------------------------------------------------------------------- PM_ME_YOUR_OPCODES · 2023-12-13 23:20 I hate the need for them. It’s a clever workaround, but having gigs and gigs and gigs of files that aren’t videos or games seems downright wasteful. Much of it duplicated, even with layerfs. ---------------------------------------------------------------------- qksv · 2023-12-13 23:20 Mastodon gives no fucks. The cronjob to clean up old data. is a must have, not a nice to have. Honestly should probably be configured automatically. ---------------------------------------------------------------------- checksum__ · 2023-12-13 23:44 systemd daemonizes, docker containerizes. They are not related in the slightest other than most Linux distributions using systemd to start docker itself. You can't use docker to start a local Linux application. ---------------------------------------------------------------------- CactusBoyScout · 2023-12-13 23:48 I also just learned you can tell it to *monitor only* specific containers. So I no longer have it automatically updating critical things like NPM and Authentik. Too risky updating those automatically and having everything go down. But stuff like Plex, Radarr, etc? Update away. ---------------------------------------------------------------------- ApricotRembrandt · 2023-12-13 23:53 Thanks for the reminder! It's been a minute apparently... >Total reclaimed space: 140.3GB ---------------------------------------------------------------------- pea_gravel · 2023-12-14 00:01 Watchtower can do that after updating your images too ---------------------------------------------------------------------- powerexcess · 2023-12-14 00:02 lol at getting downvoted after basically giving instructions about how to fix a proper nasty docker issue (clogged devicemapper). ---------------------------------------------------------------------- Evajellyfish · 2023-12-14 00:20 Oh I didn’t know we were playing semantics, what a displeasure talking to you. ---------------------------------------------------------------------- BarServer · 2023-12-14 00:29 Ok, never heard of Cronitor. Clicked the link and: > We created Cronitor because cron itself can't alert you if your jobs fail or never start. Huh? Cron sends every output via mail, as Cron assumes a successful run produces no output and has an exit code of 0. Hence the --cron option for some tools. And if you really need to know that the Cron daemon works.. Uh.. Add proper system monitoring? Make that job sent an email even it it was successful!? Sorry but I don't understand why I should need that https://cronitor.io stuff? Can someone enlighten me? ---------------------------------------------------------------------- Nebakanezzer · 2023-12-14 00:31 Why does this happen? ---------------------------------------------------------------------- power78 · 2023-12-14 00:31 It's not semantics, you said the whole point of watchtower is for cleanup, which is false. No semantics about it. Why am I even having to explain this. If English isn't your first language, I'd understand. ---------------------------------------------------------------------- majoroutage · 2023-12-14 00:38 Every so often? I keep nothing I'm no longer using. ---------------------------------------------------------------------- majoroutage · 2023-12-14 00:41 Reminds me of when my HDD would fill up with MySQL logs back in the day. ---------------------------------------------------------------------- Evajellyfish · 2023-12-14 00:41 > the whole point of watchtower is I never said that, please just stop being annoying and go be an ass- hat somewhere else. Sorry the people around you don't give you enough attention, but i think i can see why. ---------------------------------------------------------------------- power78 · 2023-12-14 00:42 You never said that? Then what's this comment: https://www.reddit.com/r/selfhosted/s/qzJqOQOOXm >This is what WatchTower is for ---------------------------------------------------------------------- trisanachandler · 2023-12-14 00:42 I'll agree with you. Modern compute abilities have made devs lazy, cheap storage has the same effect. ---------------------------------------------------------------------- Square_Lawfulness_33 · 2023-12-14 00:43 I just use watchtower with the parameter to remove images on update. ---------------------------------------------------------------------- Evajellyfish · 2023-12-14 00:43 > you said the whole point of watchtower is for cleanup I never said that. so you are wrong. I said: "This is what WatchTower is for" ---------------------------------------------------------------------- reeeelllaaaayyy823 · 2023-12-14 00:48 Is there a way to see how much would be reclaimed without actually running the prune? ---------------------------------------------------------------------- power78 · 2023-12-14 00:54 Someone needs to go back to school ---------------------------------------------------------------------- Evajellyfish · 2023-12-14 00:55 lmao please cry harder ---------------------------------------------------------------------- 21Blankenship · 2023-12-14 00:58 I love this idea, doing it now lol ---------------------------------------------------------------------- nathan12581 · 2023-12-14 01:12 Just done mine. 78GB space reclaimed 💀 ---------------------------------------------------------------------- KevinCarbonara · 2023-12-14 01:16 > I hate the need for them. It’s a clever workaround It's not really a workaround at all. It's essentially a namespace. I'm not sure what you're referring to as the "need" - containers help solve a *ton* of issues. On the other hand, Docker could clean up after itself. There's no reason why we should have to constantly prune our own images. ---------------------------------------------------------------------- guesswhochickenpoo · 2023-12-14 01:26 What's your proposed alternative to containerization? It provides a ton of value over the alternatives like installing directly on the host OS, etc. Sure there are some different issues to deal with now but overall containerization is MUCH better than how things were handled previously. ---------------------------------------------------------------------- audero · 2023-12-14 01:27 Be careful with the -a flag as it will prune all b images not currently associated with a container. Without it, it will just prune dangling images. ---------------------------------------------------------------------- guesswhochickenpoo · 2023-12-14 01:27 Keep in mind this will also remove unreferenced *networks* by default which usually isn't a big deal with vanilla setups but if you have setup any custom networks and the container(s) using them are stopped you'll have to re-create them. ---------------------------------------------------------------------- NomisGn0s · 2023-12-14 01:34 Wait till you find out you should prune volumes too ---------------------------------------------------------------------- thekrautboy · 2023-12-14 01:55 Thanks for making it clear that everyone here should simply block you. Very helpful! ---------------------------------------------------------------------- omnichad · 2023-12-14 01:58 Perhaps they're in a country that uses comma as thousands separator and this is 3 digits for the fractional part. ---------------------------------------------------------------------- thekrautboy · 2023-12-14 02:01 Havent looked at Cronitor, but for some essential cronjobs i combine them with a simple curl to healthchecks.io as a check-in, if a expected check is missed i get alerted. But the service knows nothing at all about the cronjob, i only "ping" a endpoint with curl. ---------------------------------------------------------------------- thekrautboy · 2023-12-14 02:02 Whenever you download (pull) a updated version of a container image, the old version is kept. Over time these can add up to a few gigabytes. ---------------------------------------------------------------------- thekrautboy · 2023-12-14 02:04 Yes: `docker system df` will show you how much disk space is currently taken up by which "type" of image and how much could be reclaimed. ---------------------------------------------------------------------- OccasionallyImmortal · 2023-12-14 02:20 > docker system prune -a -f This appears to remove stopped containers according to the docs. ---------------------------------------------------------------------- Blue-Paws · 2023-12-14 02:36 Why doesn't watchtower_cleanup= true take care of this? ---------------------------------------------------------------------- CactusBoyScout · 2023-12-14 02:38 Jackett updating their Docker Image every single day sure ate up a lot of my hard drive before I realized that Watchtower wasn’t removing them after updates by default. ---------------------------------------------------------------------- reeeelllaaaayyy823 · 2023-12-14 02:43 Great, thanks for that. ---------------------------------------------------------------------- root54 · 2023-12-14 03:00 I run this daily via cron: #!/usr/bin/zsh pushd /media/storage/docker_configs/portainer || exit 1 docker image prune -f docker pull portainer/portainer-ee:latest for f in $(grep -h -r "image:" compose | awk '{print $2}'); do docker pull ${f} done ...which, yes, is a lot of activity, but it means that when I visit portainer once or twice a week, I can update all my stacks and the image will likely already be downloaded. The old tags will get cleaned up the next time my script runs. ---------------------------------------------------------------------- raul_dias · 2023-12-14 03:27 prune af ---------------------------------------------------------------------- Jniklas2 · 2023-12-14 04:37 Watchtower even has a function that removes the old image after the update https://containrrr.dev/watchtower/arguments/#cleanup ---------------------------------------------------------------------- Venusn99 · 2023-12-14 04:38 Suppose if I am running docker in raspberry pi, any advantage of having ansible ? Just curious to learn Ansible and see if it works for me in this case. What can I do with ansible with docker? ---------------------------------------------------------------------- foshi22le · 2023-12-14 04:51 I use Watchtower to update my containers and delete the older images. ---------------------------------------------------------------------- WhittledWhale · 2023-12-14 05:30 Ansible really only makes sense when you've got to do things with a lot of servers / clients. Though, for learning, an RPi and curiosity is all you need, baby. ---------------------------------------------------------------------- Cylian91460 · 2023-12-14 06:11 >You can't use docker to start a local Linux application. You can? You set the location for the docker image and add any folder with it, you can 100% have a local Linux app inside docker. Did you never write a docker compose file? ---------------------------------------------------------------------- Snooras · 2023-12-14 06:14 Nice ---------------------------------------------------------------------- Hairless_Human · 2023-12-14 06:15 Is this necessary on unraid? ---------------------------------------------------------------------- Genesis2001 · 2023-12-14 06:25 Ansible's about codifying infrastructure configuration for automated deployments. It's an automation tool. * You can use it to deploy software and a preset config to a server you have. * You can integrate it with your backup solution and use it to migrate servers from one server to another (or one VM to another VM). * You can push config changes out to multiple servers. * You can run an ad-hoc command to update multiple servers at once. And other things. --- For a Pi or one-off install, it's probably not worth it. But if you're looking to get into IT or you're planning to reinstall software on other devices, it's probably good to pick up. Other competing platforms exist like Chef, Puppet, etc. But Ansible is my choice personally. ---------------------------------------------------------------------- servergeek82 · 2023-12-14 06:52 My weekly git actions job does this for me while rebuilding my stacks. Thanks though. ---------------------------------------------------------------------- checksum__ · 2023-12-14 08:12 Yes, I work with docker daily. if that is your use case you are likely using docker incorrectly and going against their documentation. You can add a volume to an executable but that executable will still run in the container, not locally on the host; and in most cases entirely defeats the purpose of using Docker. ---------------------------------------------------------------------- Cylian91460 · 2023-12-14 08:15 >and in most cases entirely defeats the purpose of using Docker. Yes but you can. >not locally on the host I consider things running in docker local as it's not in a full VM. >that is your use case I don't use docker so no it's not my use case. ---------------------------------------------------------------------- 1stQuarterLifeCrisis · 2023-12-14 10:09 My record is \~300gb. That what you get for using devcontainers and a lot of docker dev enviroment i guess lol ---------------------------------------------------------------------- Deses · 2023-12-14 10:16 Does unraid do this for me? ---------------------------------------------------------------------- kneticz · 2023-12-14 10:23 cron job runs every week to update images and prune. ---------------------------------------------------------------------- kjwey · 2023-12-14 10:30 I don't use docker ---------------------------------------------------------------------- st4s1k · 2023-12-14 11:06 this is prune af ---------------------------------------------------------------------- tenekev · 2023-12-14 11:06 Yes but that triggers when Watchtower performs the update. I don't want Watchtower do to it unsupervised. Therefore I use it only to check and download new images. Then I come around, update the images and clear the old ones. ---------------------------------------------------------------------- Mladia · 2023-12-14 11:07 Perfect! Never knew that ---------------------------------------------------------------------- ContributionDry2252 · 2023-12-14 11:19 I'm doing this with Jenkins. One Job to Prune them All... ;) ---------------------------------------------------------------------- Yanni_X · 2023-12-14 11:21 Does this also clear the build cache? If you build images from scratch or build your own images on that machine, I recommend ~~~ docker buildx prune --all docker builder prune --all ~~~ ---------------------------------------------------------------------- tenekev · 2023-12-14 11:32 This is a single feature in a piece of software with a much wider scope. It's like saying a pair of pliers is made for hammering nails because you can somewhat hammer nails with it. I can argue a hammer is made for pruning old images... permanently. Furthermore, the cleanup runs only if watchtower is doing the update. I use it to monitor and download updates. I manually update containers to avoid uncaught errors. This does not trigger a cleanup which might as well make it nonexistent for me. I submitted a request for an independent cleanup task that isn't chained to the update event but so far it's not been implemented. It's not even an independent feature. Watchtower is definitely not "made for it". ---------------------------------------------------------------------- SeaNap · 2023-12-14 12:56 I can never remember all the docker cli commands so I wrote a simple docker-compose update script that pulls, updates and cleans up the files. I might be using compose "wrong" by having all containers in a single compose file, so this script lets me update only 1 or exclude 1 or update all. [https://github.com/seanap/Docker-Update- Script](https://github.com/seanap/Docker-Update-Script). ---------------------------------------------------------------------- Ok_Sandwich_7903 · 2023-12-14 13:20 Was thinking the same. I rarely use docker so I'm not aware of such a thing. That info is useful. ---------------------------------------------------------------------- Del_Phoenix · 2023-12-14 13:30 Fr ---------------------------------------------------------------------- Evajellyfish · 2023-12-14 13:47 TLDR? ---------------------------------------------------------------------- tenekev · 2023-12-14 13:48 Yes, this explains your blind arguing. ---------------------------------------------------------------------- coff33ninja · 2023-12-14 14:10 I remember the day I found out how to do this 😭 Reclaimed 500+gb of storage just because of all the docker tests I did on bench and couldn't figure out why my storage was so little 😂😂 ---------------------------------------------------------------------- FunctionSuper37 · 2023-12-14 14:12 Every one hour? :) `#!/bin/bash` `docker rm -f \`docker ps -aq\`` `docker rmi \`docker images -q\` -f` `yes | docker volume prune` ---------------------------------------------------------------------- Sinister_Crayon · 2023-12-14 14:21 If you're doing databases you should really use bind mounts instead of volumes. At least in my opinion :) I never put anything important in volumes... everything goes into bind mounts except temporary data. ---------------------------------------------------------------------- rush2sk8 · 2023-12-14 14:41 And docker volumes ---------------------------------------------------------------------- theRealNilz02 · 2023-12-14 14:49 Or not use docker at all. ---------------------------------------------------------------------- Evajellyfish · 2023-12-14 14:56 TLDR? ---------------------------------------------------------------------- The_Caramon_Majere · 2023-12-14 14:57 Does unraid have a way to handle this for their docker applications, or must I do this on that as well? ---------------------------------------------------------------------- jpeeler1 · 2023-12-14 15:56 I maintain a bare metal CI server that is running tests for our product. A useful tool that is part of the complete hands off solution is running [https://github.com/stepchowfun/docuum](https://github.com/ stepchowfun/docuum). It only handles images, so no containers or cache. It works very well and the page outlines some of the gotchas it avoids as far as purging the correct images based on usage. In a perfect world it would not require mounting the docker socket into the container, but this is obviously the fastest and least error prone solution for getting going. ---------------------------------------------------------------------- Bluasoar · 2023-12-14 16:14 Interesting, I just have it update everything as i’m only running a Homelab not like it’s in production or anything but, wouldn’t you want to update applications like Nginx and Authentik as I would think they’re likely to patch any past exploits? Or is that not the case and it is actually a cause for concern that an update introduces an exploit? Just curious if I should change my ways haha. ---------------------------------------------------------------------- CactusBoyScout · 2023-12-14 16:19 This is probably the most hotly debated thing on this sub. I think the idea is that those services are more likely to cause issues with other services if they're updated automatically and introduce significant changes. Like if Navidrome makes some big change it doesn't affect anything except Navidrome... so I don't care. But if some big change happens with Nginx, half my services could become unreachable. So the idea is that you want to be actively doing those updates yourself so you can verify nothing breaks. I've had issues a few times where an Authentik update left one of its containers "unhealthy" and needed to be restarted manually. So now I get notifications about updates for those containers and can just do them manually every week or so when I have time to monitor the outcomes and fix anything that arises. ---------------------------------------------------------------------- ThroawayPartyer · 2023-12-14 16:37 Keep updating! ---------------------------------------------------------------------- thekrautboy · 2023-12-14 18:02 I dont know, i dont use unraid myself. You could ask in /r/unRAID. unraid doesnt make a ideal Docker host anyway, there are limitations every now and then. ---------------------------------------------------------------------- PM_ME_YOUR_OPCODES · 2023-12-14 18:02 We’re still using guest operating systems designed for bare metal. We need a new os with just enough kernel and userland, and we need an sdk for it. We could turn gigs into megs. ---------------------------------------------------------------------- WildestPotato · 2023-12-14 18:02 I have fourteen Debian 12 VM’s on my server, no need to worry about 60GB when you have 8TB of SSD in raid 6 and don’t use Docker 😀 ---------------------------------------------------------------------- murlakatamenka · 2023-12-14 18:07 Idk, such tip is as good as "clean your teeth" regularly :shrug: But likes and comments show that it is welcome. Let your drives be clean of cruft, rock and stone! ---------------------------------------------------------------------- WanderingDwarfMiner · 2023-12-14 18:07 Rockity Rock and Stone! ---------------------------------------------------------------------- Anposter · 2023-12-14 18:10 I also forgot about it until a disk full last week but not showing anywhere locally. Actually surprised and thought we improved to the point where this doesnt have to be done in a crontab. I guess not :) ---------------------------------------------------------------------- CodyEvansComputer · 2023-12-14 19:13 Yes, comma as thousands separator, period as decimal separator. ---------------------------------------------------------------------- Fun_Rock9244 · 2023-12-14 20:38 **docker volume prune --all** ---------------------------------------------------------------------- Gelu6713 · 2023-12-14 20:46 Do you have notes about how to do this? Sounds like this would save me tons of time! ---------------------------------------------------------------------- CactusBoyScout · 2023-12-14 20:58 Sure. So by default Watchtower updates all available containers on a set schedule. But you can set the Watchtower ENV variable `WATCHTOWER_CLEANUP` to `true` so that it also removes old images after an update. If you *only* want Watchtower to monitor containers (meaning nothing will get updated automated, you'll only get notifications) set an ENV variable `WATCHTOWER_MONITOR_ONLY` to `true` on the Watchtower container. But if you want to set it to update some and just notify about others, don't add the "monitor only" variable and instead add a label to the containers you don't want updated automatically. That label is `com.centurylinklabs.watchtower.monitor-only` and that means you'll get notifications for those containers but no automatic updates. Setting up the notifications is also done through ENV variables. I use Telegram, personally. It's fairly easy to set up although the instructions aren't great. So let me know if you have questions on that part. ---------------------------------------------------------------------- Gelu6713 · 2023-12-14 21:06 for the label in unraid, what's the key value to put on the label for the not updating ---------------------------------------------------------------------- CactusBoyScout · 2023-12-14 21:07 I'm not familiar with unraid unfortunately. ---------------------------------------------------------------------- Gelu6713 · 2023-12-14 21:30 no worries! thanks! ---------------------------------------------------------------------- mscreations82 · 2023-12-14 22:55 Be careful if you use something like Sablier to run services on demand. I ran this and then realized it deleted some containers that were stopped due to not being actively used. Now I run docker compose up first so they are running when I run the prune command. ---------------------------------------------------------------------- CrossboneMagister · 2023-12-15 08:42 For those that have to run docker on wsl, also remember to resize the virtual disk after pruning! ---------------------------------------------------------------------- DistractionRectangle · 2023-12-15 17:55 Like, others said, Ansible is about codifying configuration. In other words, instead of bringing things up by hand, you run play books to do things. Ideally, if you rerun your playbooks from scratch on a fresh server, you'll end up with a faithful reproduction of what you had before. With docker, I see a lot of people making the mistake of backing up volumes, but not associated docker images they're using. Then, when they need to restore, they can run into problems as the data they backed up might not work the current docker images; they now need to spend time figuring out what the current versions were to restore their data/system. Of course, like the others said, Ansible is kinda overkill for one off deployments. The above problem is easily solved by specifying version tags in your docker/docker-compose files, or by using [docker lock](https://github.com/safe-waters/docker-lock) and committing the docker/docker-compose files (and lock file if used) with your backups. If you're interested in learning Ansible, /u/geerlingguy has a thorough collection of Ansible content here: - https://ansible.jeffgeerling.com/ Ansible for Dev Ops is worth the money (and by all accounts is a steal at $10, IMHO), so if you can afford to support Jeff's work/content please do. That said, if money is tight, or you want to sample it first, he did recently open source the book, and provides full - free - copy at a link here in the comment section: - https://www.jeffgeerling.com/blog/2023/self-publishing-technical- book-10-years And if you see this Jeff, Happy Holidays! ---------------------------------------------------------------------- geerlingguy · 2023-12-15 23:31 Thank you, you too :) And I'm always happy to get the free copy out there—I figure if someone benefits from it, they have a choice to later support my work in other ways if they want. If not, hopefully they pay it forward some other way! ---------------------------------------------------------------------- Odd-Media-6139 · 2023-12-16 00:10 I wrote a custom json builder that does this whenever I update or deploy a container. Much nicer than whatever shitty solutions people are using nowadays. ---------------------------------------------------------------------- JiM2559 · 2023-12-16 19:29 Oh no wonder my disk usage is soo high. Whoops. ---------------------------------------------------------------------- philsodyssey · 2023-12-17 22:17 Don't forget about volumes. ---------------------------------------------------------------------- stove_io · 2023-12-17 23:56 And now prod is down ---------------------------------------------------------------------- FreddieDK · 2023-12-27 11:30 Thanks, I'll use this with Ansible Semaphore (WebUI for Ansible) when performing updates.