brikis98 / docker-osx-dev

A productive development environment with Docker on OS X
http://www.ybrikman.com/writing/2015/05/19/docker-osx-dev/
MIT License
1.43k stars 106 forks source link

docker-compose auto-detection brittle #153

Open cjerdonek opened 8 years ago

cjerdonek commented 8 years ago

The documentation in the README says:

If you are using Docker Compose, docker-osx-dev will automatically sync any folders marked as volumes in docker-compose.yml.

However, when I run docker-osx-dev from a directory that contains docker-compose.yml, it sometimes doesn't notice the file:

$ docker-osx-dev 
2015-12-11 20:22:07 [INFO] Using default sync paths: .

Looking at the code, I see why now: https://github.com/brikis98/docker-osx-dev/blob/c4df976c2f18cd89b93d998889d0f06d2f234a18/src/docker-osx-dev#L894

I had YAML comments in my file that broke the hacky parsing.

The lack of true support should be better documented to save people time.

brikis98 commented 8 years ago

It is indeed hacky :)

To be fair, we haven't seen too many issues with it. What did your file look like? Is there any easy fix we could put in to take care of it?

Another simple improvement would be to log a warning if a docker-compose file is found, but no volumes are found within it.

cjerdonek commented 8 years ago

Thanks, @brikis98. It looked something like this:

volumes:
  # comment
  # comment
  - <data>
  # comment
  # comment
  - <data>

I guess it wouldn't be too hard to recognize comments.

Yes, what would have helped me a lot is if the log message said something like:

[INFO] Using sync paths from Docker Compose file at docker-compose.yml: <none found>

Instead of:

[INFO] Using default sync paths: .

That way someone can know that the compose file was being found but just that no paths were parsed out.

brikis98 commented 8 years ago

Both fixes seem useful. PRs are more than welcome :)

cjerdonek commented 8 years ago

Okay, if I have time, I'll do it. :) By the way, I just noticed that if you pass explicit sync paths using the -s option, it still looks at your compose file. Is this intended? If not, is there a way to have the compose file be ignored?

cjerdonek commented 8 years ago

(To clarify, it merges these lists, using both the explicitly passed sync paths in addition to what is in the compose file.)

brikis98 commented 8 years ago

I don't think there is a parameter to specifically ignore the compose file, but you could just the compose file path with the -c parameter to a file that doesn't exist.