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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With