3 ms·
Yes. Volumes: https://docs.docker.com/engine/admin/volumes/volumes/ https://docs.docker.com/engine/admin/volumes/volumes/ Mount a directory from your local fil
by drodgers 9y ago
Yes. Volumes: https://docs.docker.com/engine/admin/volumes/volumes/ https://docs.docker.com/engine/admin/volumes/volumes/
Mount a directory from your local filesystem as a volume and file changes within that directory will appear immediately in the container.
- fpoling 9y agoThis even works when one uses docker build to compile things. Just have a shell script that after the build copies the compilation result to a local directory mounted as a volume in the docker container.
- cdancette 9y agoWhy not compile inside the volume already?
- fpoling 9y agoThis is what I have used before docker build started to support multiple images. That is, I had a shell script that run an image with a compiler that put the executable to a local directory. Then normal docker build would pickup the executable into the final image. But this does not take advantage of caching with docker build and made the infrastructure more complex. Dockerfile with multiple images addressed that nicely. Now single docker build command takes care about everything and generates production ready images. A shell script is only necessary during development to extract some files from the image to avoid restarting already running container.
- jypepin 9y agomy understanding is that volumes are more for persisting data on your host's filesystem, right? I'm talking more about having code you write automatically sync'ed inside the container - do volumes offer that?