Reputation: 2426
My team is using docker-compose
for our project's container.
Previously, while we were learning how Docker works, we were just using docker
. In docker
, I could instantly see my local changes on my local deployment by attaching a bind mount to the container when I run it on the command line.
Now, using docker-compose
, there doesn't seem to be any such option - my workflow is docker-compose up
with little opportunity for deviation. I believe I can specify a bind mount as a volume in our docker-compose.yaml
. But that's not really what I'm looking for.
I'd like to be able to specify a local, personal, temporary bind mount without having to modify my team's docker-compose.yaml
or commit my personal preferences to vc. How can I specify my bind mount from command line, or equivalent?
Upvotes: 1
Views: 477
Reputation: 1847
Looking at the docs, there doesn't seem to be such an option from the commandline.
One way to get similar behavior to what you want is to make a second docker-compose file with the personal options. If you name it docker-compose.override.yaml
, it will be picked up automatically. Otherwise, you can use the -f
flag to load it, like so
docker-compose -f docker-compose.yaml -f docker-compose.user.yaml up -d
More details for using multiple docker-compose files are documented here (thanks @Sysix).
You could put this filename into gitignore.
Upvotes: 3