I’m not sure how docker implements volumes, but I can tell you what happens when you use one.
Everything what you had in the container at the point where you mount the volume to, will dissapear and replaced by what you have on the host. Changes you make from the container in the volume, appear on the host as well and changes made on the host do appear in the container as well.
The most common use case for volumes is persisting data from the container, eg databases are writing their files on volume, such that the data persists even between container updates.
Also I’ve seen volumes beeing used as a kind of IPC, via a file that both (host and container) read and write. I tend to replace those ugly mechanics with proper signal handling or a management protocol over IP/REST on a dedicated port.
They are not meant to share sourcecode during development. If changes of your sourceode on the host are visible in the container instantly without needing it to rebuild, you are doing it wrong. Especially as build artifacts are created by host simply by starting the editor (at least in the days of ElixirLS) which might confuse the container as it sees those artifacts and thinks it doesn’t need to recompile, but in fact the artifacts might be for a different ARCH or OS or just with a different environment.






















