Reputation: 6831
I am using docker and I mount my code in /var/www/code
in host in my development.
Now when I want to release my stuff in production I have two doubts
I am not sure which way to go
Upvotes: 2
Views: 578
Reputation: 18679
Both are valid ways of doing things. If you use kubernetes, Amazon Container service etc you probably have to use option 2 as they do not support host mounted volumes. Option 2 is also more portable as you can move containers around on a multi-node docker swarm easily. However, if you already have a deployment system setup using chef or cloud-formation etc option 1 does allow for more generic containers which are not tied to versions of your code.
Volumes themselves can never be part of the image as they are always mounted from hosts. However, you can make a generic base image and then have docker file in your code repo with
from my-user/my-generic-base
ADD /code:/var/www/code
When you deploy your downstream container to dockerhub make sure you deploy it with a version number which indicates the code version it will run.
Upvotes: 1