Hacker News new | ask | show | jobs
by qaq 3503 days ago
Not being a fan of docker but "Since images sizes can be as high as few GB, its easy to run out of disk space. This is another problem with docker which you have to figure out yourself. Despite the fact that everyone who’s ever used docker seriously has to come across this issue sooner or later; no one tells you about this at the outset" - monitoring free disk space is something you definitely want to do regardless of using docker or not.
5 comments

It's not that hard to work around this:

I've deployed a global unit into our coreos cluster that regularly executes:

    #!/bin/sh
    while :; do
        # remove stopped containers w/ volumes
        docker ps -a -q -f status=exited | \
            xargs -r docker rm -v
        # remove dangling images
        docker images -f "dangling=true" -q | \
            xargs -r docker rmi

        sleep 6h
    done
You need to be sure that you don't lose important data when running something like this in your setup, but it works nicely to remove old images. This script is deployed to non-coreos servers as well.
I want to use Docker in production so I don't have to write hacks like this.

I want to put my application, any application, in a nice tidy box, ship it to a server, any server, an be confident that it'll work. That's the promise of Docker. To me, Docker doesn't deliver on that promise if I have to copy&paste a 12 line bash script from HN to be able to do that or else face out-of-space problems at surely the worst possible moment. If I have to jump through hoops like that, then what's the gain?

Might as well just install an Ubuntu VM, apt-get everything I need by hand or with ansible and add my app to the startup script. I'll have similar complexity in a more mature and well-understood environment.

If you are running a simple homogeneous setup there is literally no gain.
The size of docker images ended up being the reason we aren't using it. Transfering them took forever, and so if we had an emergency update to make, we'd have to go outside our normal routines, which is brutal.

I'm sure we'll end up finding another way that's similar (provides the same benefits for us) but without such crazy image sizes.

Is your app gigabytes in size? Docker can't help you with that, but nothing else is going to help you, either. There has been a ton of momentum lately in getting Docker images pared down to miniscule (e.g. ~25MB... megabytes) image sizes with for example alpine. If you're using something like "ubuntu:14.04" for your images, this is absolutely a problem you can solve.
Spotify has a nice solution for container cleanup: https://github.com/spotify/docker-gc
I just switched to this, problem solved. But I tried sevarl other solutions and found many were out-dated and no longer worked well, with no doc on which version of doc the approach worked with. Should be built into docker IMO and I've heard 1.13 will have a clean-up facility built in.
For those interested, this is built into rkt with `rkt gc`, for an easy cron job experience. You can set a grace period for how old an image has to be to qualify.

Check it out at https://coreos.com/rkt/docs/latest/subcommands/gc.html

Would you recommend using rkt in production instead of Docker? My impression was that rkt is even more immature, but maybe that's entirely wrong.
I'm biased as I work at CoreOS but I'll add that it should be a drop-in replacement for Kubernetes.

`kubelet --container-runtime=rkt` and be on your way.

Honestly I don't think I've ever had to worry about it. The Mesos GC just does it's thing for us.

Honestly didn't even realise this was such a big deal for so many.