brikis98 / docker-osx-dev

A productive development environment with Docker on OS X

Home Page:http://www.ybrikman.com/writing/2015/05/19/docker-osx-dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-compose auto-detection brittle

cjerdonek opened this issue · comments

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:

# Parses out all volumes: entries from the docker-compose file

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.

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.

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.

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

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?

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

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.