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

Use project name in Compose commands in the Container panel #2755

Closed
petergloor opened this issue Mar 6, 2021 · 5 comments · Fixed by #2788
Closed

Use project name in Compose commands in the Container panel #2755

petergloor opened this issue Mar 6, 2021 · 5 comments · Fixed by #2788

Comments

@petergloor
Copy link

petergloor commented Mar 6, 2021

Issue Type: Feature Request

Whenever I start a project using Docker: compose up from the command palette (ctrl+shift+P) it starts a project using the name of the directory that contains the docker-compose.yml file. The name of this project appears in the Containers panel. A right mouse click provides the commands Compose Logs, Compose Restart and Compose Down. So far this works fine.

However, in case I start docker compose -p <project name> up using an alternative project name from a Terminal window, the project name will be the one provided with the -p parameter and not the projects directory name.

In this case the Compose commands in the Containers panel will fail, because the parameter -p with the right project name is missing in the docker-compose command executed under the hood.

Note: of course it's always possible to execute the commands from a terminal window, but especially when using remote contexts it would be nice if the commands would be available.

Extension version: 1.10.0
VS Code version: Code 1.54.1 (f30a9b73e8ffc278e71575118b6bf568f04587c8, 2021-03-04T22:38:50.094Z)
OS version: Linux x64 5.8.0-44-generic
Remote OS version: Linux x64 5.4.0-66-generic

@petergloor petergloor changed the title Use project name in Compose commends in the Container panel Use project name in Compose commands in the Container panel Mar 6, 2021
@petergloor
Copy link
Author

Using Inspect on the containers, the project name can be found in the Config/Labels section:

{
"Config": {
    "Labels": {
        "com.docker.compose.project": "<project-name>",
    }
}

@bwateratmsft
Copy link
Collaborator

Related to (but not the same as) #2633

@bwateratmsft
Copy link
Collaborator

Should be straightforward to fix, as @petergloor points out the project name is available from the label com.docker.compose.project and can be applied unconditionally (i.e. using -p <the name> works even in the "normal" case where the project is started without -p <name>).

@BigMorty
Copy link
Member

Love it, thanks @petergloor!!!

@bwateratmsft
Copy link
Collaborator

This fix is now released with Docker extension version 1.12.0.

@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants