I have created a docker image container which is running on a virtual machine (with docker toolbox). My Problem is now that I don't know in which windows path I can store my files for the development? Also I'm not sure how I can open this image container in the browser (docker-machine ip)?
1 Answers
It seems that you need to define a data volume. In short you declare a volume in your Dockerfile thus declaring that this path in your container will essentially be bound to a path on your host (that'd be your VM if I understand the setup correctly). E.g. (say that you want your shared path to live in /var/www in your container, then you add something like next command in your in your Dockerfile):
VOLUME ["/var/www"]
Then upon spinning up your container you bound it to your host's path:
E.g. (say your code lives in /src/webapp in your VM):
docker run -v /src/webapp:/var/www
While you are at it you may want to consider fitting your setup to the 'data volume' pattern (in short having another container playing the part of a shareable data volume) which is generally considered best practice for working with persistent data in Docker.
See docker documentation for details: https://docs.docker.com/engine/tutorials/dockervolumes/ and this thread How to deal with persistent storage (e.g. databases) in docker for more on the 'data volume' pattern.

- 1
- 1