Closed ComaVN closed 7 years ago
I didn't know that was even supported. I thought you used the volumes_from
entry for that? Or is this something new?
Seems like it's been available for a while: https://github.com/docker/compose/issues/1823
Yeah, named volumes are the unofficially/officially (https://github.com/docker/docker/issues/17798) recommended alternative to data-only containers since Docker 1.9.0. We recently switched to them and noticed this as well :)
The named volumes need to be declared in the docker-compose.yml file like this:
version: '2'
volumes:
data:
gems:
services:
rails:
build: .
command: bundle exec rails s
ports:
- "3000:3000"
links:
- redis
volumes:
- gems:/gems
redis:
image: redis
volumes:
- data:/data
Reference: https://docs.docker.com/compose/compose-file/#volumes-volume-driver
One approach would be to parse the names under the top-level volumes:
key and then just not ignore those later when parsing volumes-lines under the service.
Reproduced as well, it really is a problem.
volumes:
ugc: {}
2016-08-23 14:40:58 [INFO] Initial sync using tar for /Users/ain/projects/.../ugc
tar: ugc: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors.
This should have been fixed by #197.
When defining named volumes in docker-compose.yml, docker-osx-dev assumes them to be relative paths:
Result:
I did not expect
mynamedvolume
to be synced