The Shared Volume Dev Container All my dev containers share at least one volume with the host:/home, which is for easy development. For many apps, in development mode, use File-system-change-based Code-reloader to run, so that the container It encapsulates os/distro-level dependencies and helps validate app-as-bundled work in the initial environment without having to restart/rebuild VMS every time the code changes. As for the other, I just need to reboot (not rebuild) the container to respond to the code changes. For test/staging and production containers, in most cases, instead of volume shared code, use "Add" to add code to the Docker container. This is the dockerfile of my "homepage" Dev container, for example, including my personal wiki, which exists in the "devbase" container under/home, and the following shows how to use the shared base container and/home volume: From Vidarh/devbase Workdir/home/vidarh/src/repos/homepage entrypoint bin/homepage Web The following is Dev-version's blog: From Vidarh/devbase Workdir/user Root # for GRAPHIVZ integration RUN apt-get Update RUN apt-get-y Install Graphviz xsltproc ImageMagick USER Vidarh Workdir/home/vidarh/src/repos/hokstad-com entrypoint bundle EXEC rackup-p 8080 Because they fetch code from a shared library and are based on a shared base container, these containers are often rebuilt very quickly when I add/modify/delete dependencies. Even so there are some places where I am very willing to improve, although the above base is lightweight, most of them are still unused in these containers. Since Docker uses Copy-on-write overlay, this does not result in a huge overhead, but it still means that I do not have the minimum resource consumption, or the chance to minimize attack or error.
|
Eight Docker container development models---The Shared Volume Dev Container