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

Docker compose remote container project name issue #498

Closed
Lokiem opened this issue May 29, 2019 · 5 comments
Closed

Docker compose remote container project name issue #498

Lokiem opened this issue May 29, 2019 · 5 comments
Assignees
Labels
containers Issue in vscode-remote containers *duplicate Issue identified as a duplicate of another issue(s)

Comments

@Lokiem
Copy link

Lokiem commented May 29, 2019

I know what this issue is, what causes it, and what is required to fix it, though this issue does relate to Docker Toolbox it appears to be a relatively minor change.

I believe recently a change was made to the Remote Container extension, somewhere in the last week or two that added an underscore to the project name on docker-compose.

On Windows, Docker Toolbox installs version 1.20.1 of docker-compose, and in this version the only characters supported in the project name are alphanumerics. The extension appears to use the project name of the current directory + "_devcontainer" e.g. "currentdirectory_devcontainer", which causes the process that creates the container to wait forever after creating the container, the "Creating ContainerName ... done" bit.

It's waiting for an event from the project name specified earlier, "currentdirectory_devcontainer" but any unsupported characters are stripped out of the project name, so this event never comes, what does come however is an event for "currentdirectorydevcontainer".

The fix is to remove the underscore, though as the code isn't open source, I can't speak of the impact this might have for anything else. If the underscore was added for nothing functional, there is a minor win for Docker Toolbox users.

A workaround temporarily is to allow the process to hang after creating the container, close the code-insider window, open another code-insider window and instead attach to the running container.

This would probably happen regardless of OS, version of insiders, specifics of the project, etc. The key players would be the docker-compose version (1.20.1~) and likely anything after version 0.53.0 / 0.54.0 of the Remote - Containers extension.

Hopefully there is enough information here to assist anyone currently experiencing this issue, and to pinpoint the exact location / version this issue came from.

@chrmarti
Copy link
Contributor

The problem we were fixing here is that if the devcontainer.json is in the .devcontainer folder, the project name would always be devcontainer which is not unique and resulted in conflicts when you tried to work on two compose projects.

We could add a config option for the project name to the devcontainer.json or look into letting COMPOSE_PROJECT_NAME pass through from a .env file.

I'd like to avoid Toolbox-specific fixes since that is not supported.

@chrmarti chrmarti added feature-request Request for new features or functionality containers Issue in vscode-remote containers labels Jun 17, 2019
@Lokiem
Copy link
Author

Lokiem commented Jun 17, 2019

More configuration options is definitely a winner, being able to set the project name in the devcontainer.json would be great.

@chrmarti
Copy link
Contributor

You have some indirect control over it: As a workaround you could move your docker-compose.yml to a subfolder (or the main folder). We only add the _devcontainer when the docker-comopse.yml is in the .devcontainer folder.

@rawtaz
Copy link

rawtaz commented Feb 23, 2020

Got bitten by this too right now. Two completely separate projects, each with their docker-compose.yaml file in the source/ folder in the project. Docker Compose doesn't have a problem with this because in each of those folders is a .env file with COMPOSE_PROJECT_NAME=foo where "foo" is different in the two projects. This makes Docker Compose treat these as separate projects, and there aren't any conflicts with image/network/volume/container names at all.

However, the Remote Container extension doesn't pay attention to the .env file and the COMPOSE_PROJECT_NAME environment variable, so it fires both projects up with the project name "source". After that, things go downhill right away - e.g. in the file explorer both project windows show the same content, and both project windows are obviously attached to the same project's container, instead of separate containers.

The Remote Containers really has to take into account the configured project names, otherwise it's pretty unusuable without ugly workarounds like moving docker-compose.yaml into differently named folders. Not really workable when you have lots of projects :)

Just fixing #222 should solve the project name issue once and for all..

@chrmarti chrmarti added this to the March 2020 milestone Feb 25, 2020
@chrmarti chrmarti added bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Feb 25, 2020
@chrmarti
Copy link
Contributor

chrmarti commented Mar 9, 2020

Fixing with #222

@chrmarti chrmarti closed this as completed Mar 9, 2020
@chrmarti chrmarti removed this from the March 2020 milestone Mar 9, 2020
@chrmarti chrmarti added *duplicate Issue identified as a duplicate of another issue(s) and removed bug Issue identified by VS Code Team member as probable bug labels Mar 9, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers *duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

3 participants