Explicitly mount files with docker-compose
When mounting files in docker compose, like this:
volumes: - ./file-to-mount:/target/file-to-mount
an empty directory is created inside the container, if the
file-to-mount does not exist! This leads to annoying debug sessions…
One can use the following syntax (with docker-compose 3.4), to mount a file more explicitly:
volumes: - type: bind source: ./file-to-mount target: /target/file-to-mount
Now, when the file does not exists, it is not possible to start the container.
invalid mount config for type "bind": bind source path does not exist...