docker-sync icon indicating copy to clipboard operation
docker-sync copied to clipboard

Docker Compose 1.17 fixed volumes override 🕊

Open michaelbaudino opened this issue 7 years ago • 4 comments

I would like to notify everyone here that Docker Compose just fixed a bug where we could not override volumes with different modes. The fixed was released as part of version 1.17.

It's particularly useful to us (DockerSync users) because it will let us properly use the default (DockerSync-free) configuration in docker-compose.yml:

services:
  your_app:
    volumes:
      - .:/app

And just put the DockerSync-specific stuff in another Docker Compose file (e.g. docker-compose.override.yml because it's automatically used when it exists):

volumes:
  - your_app-sync: { external: true }

services:
  your_app:
    volumes:
      - your_app-sync:/app:nocopy

To be explicit: this configuration was failing prior to the above bugfix because of the :nocopy mode which was preventing a proper override.

It means that DockerSync users can have their DockerSync configuration isolated (e.g. in afile ignored by git), and thus stop messing with the project configuration that could have been used by non-DockerSync users too.

DockerSync and not-DockerSync users shall now leave at peace again ❤️ 🕊 (even when working on the same project 🙏).

PS : should we document this somewhere? It looks to me that it should be a best practice (and probably even the default way to configure DockerSync).

PS2: TL;DR DockerCompose upgrade command (for MacOS, at least):

curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

michaelbaudino avatar Nov 28 '17 08:11 michaelbaudino

That's good news!!

tripox avatar Nov 28 '17 08:11 tripox

@michaelbaudino yeah i am aware of that, see https://github.com/laradock/laradock/issues/1226#issuecomment-347459342 .. but i was not aware of the fix, thank you for informing use, awesome!

EugenMayer avatar Nov 28 '17 09:11 EugenMayer

@michaelbaudino not yet sure how we tackle this in the docs. The point is, having a mount in dc.yml means you treat dc.yml as no production, which is not what you should do actually. You dev stuff should go into -dev .. this way those issues never come up in the first place.

Anyway, i guess we have to wait a little to have the newest dc version spread so people can actually rely on it - or we add this in the docs as "if you want that, install dc from source" .. but this makes things complicated again i guess

EugenMayer avatar Nov 28 '17 09:11 EugenMayer

Wow good news !

scaule avatar Nov 28 '17 09:11 scaule