Richard Bucker

Docker - Data-Only Containers

Posted at — Aug 26, 2014

I recently deployed shykes devbox setup and while he did not provide a docker build or docker run command I was able to get things running:docker run -it -v /media/state/shared/:/var/shared/ rbucker/devbox /bin/bashSadly, in my case, I mounted the volume from my host system; but in the dockervolumes article there is a recommendation that “we” use data-only containers. On the surface that makes plenty of sense until I read this comment:Volumes persist until no containers use themThis really creates a potential problem if you hope that you data is going to survive. In my case I might want to have a redis and/or postgres microservice. If I used a data-only container and either redis or pg crashed then the data-only container and it’s data will be gone. The only way that this might be resolved is if the data-only container then used a host volume. That way (a) you get the benefit of linked volumes; which might someday be networked (b) some sort of persistence.