Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy docker container to production preserving mounted volumes

Tags:

docker

In my dev machine I have app container with mounted code directory f.e -v /host/code:/app/code

What is the best practice of deploying such containers to production? How should I pack this mount binding inside container in a way that in prod I would only execute "docker load"... and get everything work.

like image 971
zim32 Avatar asked Dec 30 '15 10:12

zim32


People also ask

Which option allows containers to run with persistent volumes?

Docker has an option to allow specific folders in a container to be mapped to the normal filesystem on the host. This allows us to have data in the container without making the data part of the Docker image, and without being bound to AUFS.


1 Answers

The best practice is to use a data volume container (a container which is only docker create'd, not docker run, because it does not run any process)
See "Creating and mounting a data volume container"

That way, you can easily export and deploy that container alongside the other instead of relying on a local host path which might not be available once on the production host.

like image 178
VonC Avatar answered Sep 28 '22 02:09

VonC