Closed mauricioklein closed 8 years ago
Would love to see this merged.
Looks good! :+1:
Fyi: docker-compose is using labels instead of names to identify containers now (since v1.3.0 I think): https://github.com/docker/compose/pull/1356.
A bit hackish, but in my project I'm setting a bunch of custom labels which I use to identify containers: https://github.com/playpasshq/docker-compose-api/commit/7ca4a2ebad95a2224332dee9fd6b4f01f4f335f7. (setting the labels happens on a higher level right now)
@jeroenj
Indeed compose is now using label instead names to recognized containers started previously. Docker-compose-api does the same, except if you inform a container name. If no name is provided in compose file, label is used to create a new container name. This was the best approach I found, given the current state of gem. Of course, in the future we can do a major refactoring and turn this gem fully conform with original Compose, but I think that, for a very first version, it fulfills its purpose.
Let me know if you guys share the same thoughts. Thanks!
@mauricioklein I agree. As it is now (including this feature) it does what I expect and does everything I need for the project I am using it for.
At some point it might be nice that it does exaclty the same as compose itself, but I think it would involve quite some work. You already did a good job on the gem right now! :+1:
This PR provides the ability to compose recognize containers started by it previously and reload them in a different context.
This is done analyzing the containers name, searching for those who has the same pattern of current compose.
This feature is optional and must be enabled explicitly on compose load method (instructions provided on README file).