Skip to content

Honor default Docker context for WSL 2#1290

Merged
bwateratmsft merged 18 commits intomasterfrom
bmw/wsl2
Oct 7, 2019
Merged

Honor default Docker context for WSL 2#1290
bwateratmsft merged 18 commits intomasterfrom
bmw/wsl2

Conversation

@bwateratmsft
Copy link
Collaborator

Resolves #1199

@bwateratmsft bwateratmsft added this to the 0.9.0 milestone Sep 19, 2019
@bwateratmsft bwateratmsft requested a review from a team as a code owner September 19, 2019 19:30
@microsoft microsoft deleted a comment from azure-pipelines bot Sep 20, 2019
@microsoft microsoft deleted a comment from azure-pipelines bot Sep 20, 2019
@bwateratmsft bwateratmsft requested a review from a team as a code owner October 7, 2019 14:28
addDockerSettingsToEnv(process.env, oldEnv);
ext.dockerodeInitError = undefined;
ext.dockerode = new Dockerode();
ext.dockerode = new Dockerode(process.env.DOCKER_HOST ? undefined : tryGetDefaultDockerContext());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tryGetDefaultDockerContext cannot be async. VSCode does not appear to await activation of the extension; as a result if refreshDockerode is async then it completes at a somewhat unpredictable time later. The consequence of this is that you get a flash of "cannot connect" since the dockerode object isn't initialized yet, before it starts working. Also, tests fail miserably because each of the tree tests results in ~4 setting changes, thus four calls to refreshDockerode; eventually ext.dockerode would get overwritten by one of them during a test, causing it to fail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the tests don't change settings that affect dockerode. Perhaps we should be more selective in terms of which setting changes cause a refresh

Copy link
Collaborator Author

@bwateratmsft bwateratmsft Oct 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to but I'm not sure we can, without redefining the settings, which I'm not sure we can do. If the settings for the DOCKER_* environment variable settings were in their own subgroup, like docker.environment.*, we could be more specific; but since they're just docker.* we're kinda stuck.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, we can filter on specific settings with e.affectsConfiguration, so I did that. Still has to be sync though to avoid the problem with the UI quickly flashing "cannot connect" on first activation.

@bwateratmsft bwateratmsft merged commit 582a849 into master Oct 7, 2019
@bwateratmsft bwateratmsft deleted the bmw/wsl2 branch October 7, 2019 19:04
@bwateratmsft bwateratmsft removed their assignment Oct 8, 2019
@microsoft microsoft locked and limited conversation to collaborators Oct 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Honor the Docker context when running in WSL 2

3 participants