We run a self-hosted Discourse site on DigitalOcean and have a 25 GB Disk. I just tried to update our Discourse image and got a you will need more space to continue message. After cleaning the docker image and containers, we’re still 0.4 GB short.
Any advice on how to save space? Both in order to update now and also how to save space in the future. I know we’ll need to resize soon, but it’d be helpful to make it through at least one more Discourse image update.
We use DigitalOcean’s backup functionality. I haven’t seen an option for manually deleting one of our backups.
How would I go about doing this? I’m someone who does not have programming experience but am capable of understanding what to do and why I’m doing after getting some directions.
It is important to understand why you have intermediate untagged images showing as <none> <none> in order to avoid them since, as you have seen, you can’t remove them if they are in use.
The reason untagged images happen is because you built an image, then you changed the Dockerfile and built that image again and it reused some of the layers from the previous build. Now you have an untagged image which cannot be deleted because some of it’s layers are being used by a new version of that image.
The solution is to:
Delete the new version of the image
Delete the untagged image and
Rebuild the new version of the image so that it owns all of the layers.
You will be left with a single tagged image that contains all of the layers of the previous untagged images and the new image.
I wasn’t expecting to find 2.64 GB in a docker image, so now I’m trying to figure out what’s happening there. If I don’t need this image at all, then we are definitely far from needing to resize.
How long? I don’t see any hint of that - I do know that I’m happily running one forum on 20G and another on 25G.
Under shared you might well have a lot of backup data (perhaps in shared/standalone/backups/default). You might also possibly have old database copies, or old log files. I’d recommend you run du -kx / | sort -n | tail -49
or similar.
It’s fair to note that you can save time, at the expense of money, by moving to a larger instance. Or you can make the opposite tradeoff.
This worries me a bit. DO might well help you with backups of your whole system, but if it were me, I’d be happier to know how to take Discourse backups and how to get a safe local copy. And how to prune the backups. (If by some misfortune DO deleted your instance and your account, you’d want your data to survive that.)
We use the Discourse backup functionality, too, and I realized that we hadn’t cleared the old backups there.
Well, I deleted all but the most recent backup using the Discourse interface and also downloaded the newest backup to my local drive. That brings me to less than 100 MB away from having enough space.
Here’s what I get when I run that command in var/discourse
Where {image_name} is the name of the image you want to delete. You can also use the image ID to delete the image (e.g., docker rmi {image_id}). This is what you will need to use to delete an image with a name of <none>.
For example, Let’s say you have the following images:
REPOSITORY TAG IMAGE ID CREATED SIZE
my-new-image latest c18f86ab8daa 12 seconds ago 393MB
<none> <none> b1ee72ab84ae About a minute ago 393MB
my-image latest f5a5f24881c3 2 minutes ago 393MB
It is possible that the <none> image cannot be deleted because the my-new-image is using some layers from it. What you need to do is:
What that does is remove my-new-image:latest which is reusing layers from the <none> image. It then deletes the <none> image using it’s image ID b1ee72ab84ae. Finally it rebuilds my-new-image creating all of the layers that are needed.
Also check to make sure that you don’t have stopped containers that are still using the <none> “untagged” image. Use docker ps -a to see all image including ones that have exited. If so, use docker rm {container_id} to remove the container and then try and remove the <none> image again.
This did the trick and I changed the policy as well!
I still want to track down the issue with the <none> image (since it’s ridiculous that it’s taking 2GB+ space), but you solved my most immediate problem of creating enough space to upgrade! Thank you!!