Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

projectOptions could be public so external code can use its toProject method to create types.Project #10102

Closed
tigerinus opened this issue Dec 19, 2022 · 2 comments

Comments

@tigerinus
Copy link
Contributor

Description

I am trying to build a simple code (https://go.dev/play/p/9fcBrgupBpW) in Golang to interact with Docker Compose.
The problem is - after creating a compose project based on the given docker-compose.yml file, no project is listed.
What's expected is something like

$ docker compose ls -a
NAME                STATUS              CONFIG FILES
wp                  created(2)          /home/ubuntu/junk/wp/docker-compose.yml

Inspected the containers created by my code, I noticed that com.docker.compose.project is missing:

            "Labels": {
                "com.docker.compose.config-hash": "350500cdc96e61d71aaecffc207b3b5fd3acbd3e76f29fd278be28265052d7e6",
                "com.docker.compose.container-number": "1",
                "com.docker.compose.depends_on": ""
            }

Looking into compose code, it looks like the label is added as part of toProject(...) method of struct projectOptions, which apparently is not public, so I will have to recreate the same logic in my code to get this to work. Basically I copied the same code from https://github.com/docker/compose/blob/v2/cmd/compose/compose.go#L190-L203

It'd be nice to make projectOptions public so external code can use its toProject method to create types.Project.

@tigerinus
Copy link
Contributor Author

@ndeloof please see my PR. Thanks!

@ndeloof
Copy link
Contributor

ndeloof commented Dec 20, 2022

closed by #10103

@ndeloof ndeloof closed this as completed Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants