For local dev I need to mount a different config file in a Docker container. This is easy with the command line -v $(pwd)/bla.yaml:/location/bla.yaml
. Is it possible to do this from a volume
(created with docker volume create bla
) in a docker-compose
file?
The Docker CLI provides the –mount and –volume options with a run command to bind a single file or directory. Both flags work similarly but have different syntaxes. As a result, we can use them interchangeably.
You should be able to do it with a bind mount:
version: "3.2"
services:
app:
image: app:latest
volumes:
- type: bind
source: ./bla.yaml
target: /location/bla.yaml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With