You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
howto configure docker context within workspace #6576
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?
Reacted by Kento Moriwaki, francoislefebvre, Niruchie and Jan Holcak
Christof Marti (@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.
Activity
[-]howto configure docker context with workspace[/-][+]howto configure docker context within workspace[/+]chrmarti commentedon Apr 8, 2022
This should work locally, when connecting through an SSH server we ignore the context on the SSH server.
cgeers commentedon Apr 8, 2022
Christof Marti (@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 viaDOCKER_CONTEXTenvironment variable, or by a--contextcommand 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 commentedon Apr 25, 2022
While the docker context handling isn't blocking, it should be low hanging fruit. May I submit a patch someplace for consideration?
chrmarti commentedon Apr 28, 2022
The relevant code is not public. I need to take another look, it seemed more complicated than I hoped last time I checked.
bhack commentedon Jun 7, 2022
Other then this case it seems also that it is still ignoring the docker context #5420
navels commentedon May 8, 2024
Any possibility of movement on this?