vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

howto configure docker context within workspace

Open cgeers opened this issue 3 years ago • 6 comments

Asking this here because I suspect this is actually a bug or missing feature.

How might one configure a docker context with a particular workspace such that when using dev containers remotely the workspace always uses a configured context? I've attempted to use settings: {"docker.context": "my-context"} but it appears as though this setting is only used by the docker plugin, and not remote containers. I've also scoured the devcontainer reference for some way I specify an environment variable (DOCKER_CONTEXT) to be applied to the local environment before the remote container is created (thus leveraging the correct context), but this doesn't appears to be an option.

Dev containers work well on remote machines withdocker context use my-context but this is actually global setting for your docker client. vscode remote container should not require a global docker client setting when there are simple ways to specify a context at container creation time via the DOCKER_CONTEXT environment variable, or the --context global flag. Vscode appears to support neither of these methologies as best as I can tell.

Any thoughts or advice?

cgeers avatar Apr 05 '22 18:04 cgeers

This should work locally, when connecting through an SSH server we ignore the context on the SSH server.

chrmarti avatar Apr 08 '22 08:04 chrmarti

@chrmarti Thanks, but this is not about "chaining" docker contexts or bouncing through one or more remote servers. Explicitly setting your global docker context works fine -- docker context use my-remote-context, but this is an invasive requirement considering there are simple alternatives for configuring the name of the docker context to use ahead of time and using it regardless of what the default docker client setting is. This can be done via DOCKER_CONTEXT environment variable, or by a --context command line flag.

Either of these methodologies seems viable given the current reliance on the docker cli. If, at some point in the future this implementation is changed to use an OCI API endpoint instead, then there are more options available for achieving this behavior. But as it stands, this ought to be fairly straightforward.

cgeers avatar Apr 08 '22 14:04 cgeers

While the docker context handling isn't blocking, it should be low hanging fruit. May I submit a patch someplace for consideration?

cgeers avatar Apr 25 '22 16:04 cgeers

The relevant code is not public. I need to take another look, it seemed more complicated than I hoped last time I checked.

chrmarti avatar Apr 28 '22 12:04 chrmarti

Other then this case it seems also that it is still ignoring the docker context https://github.com/microsoft/vscode-remote-release/issues/5420

bhack avatar Jun 07 '22 11:06 bhack

Any possibility of movement on this?

navels avatar May 08 '24 02:05 navels