问题
I have an application with this structure.
/path/releases
/path/releases/01012016
/path/releases/16012016
/path/releases/etc..
And
/path/dev
(symlink to some version)/path/stag
(symlink to some version)/path/stable
(symlink to some version)
My docker-compose.yml looks like this:
nginx:
...
volumes_from:
- data
php:
...
volumes_from:
- data
data:
volumes:
- /path/stable:/var/www
I known that Docker resolves symlinks. I have thought before deploy I just recreate data container and it's ok. But it's not.
I have to recreate all containers taking volumes from data container.
Any idea how to make it better, I mean better automatic? Remove symlinks and put last version to docker-compose
? Mark parent folder as volume and resolve it via relative symlink? Or any other solution.
Which solution is best for you. What's the best practice.
Thank you. Felix
回答1:
If you just want to make it more automatic, recreating all the containers in one docker-compose.yml can be achieved with docker-compose up --force-recreate
.
Another solution would be:
/path:/var
…then ln -s /path/releases/06012016 /path/www
when you want to change.
I don't like much this solution as it exposes all your releases inside your containers. I would rather go for the full restart --force-recreate.
来源:https://stackoverflow.com/questions/35080224/docker-compose-symlink-in-deployment