-
Notifications
You must be signed in to change notification settings - Fork 522
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.host ignored in docker-build task. #2590
Comments
This comment seems very relevant:
At the least it feels like task environment variables should actually be applied. |
I believe the environment variables could be integrated pretty easily by passing them in here:
{ cwd: folder.uri.fsPath, env: environmentVariables }, Of course this would require passing environment variables from the task definition into the Even ignoring the inability to set
|
Thank you for the detailed investigation! Indeed you are correct in pointing out that comment--at the time we intentionally did not pass in That said, these tasks aren't meant exclusively for debugging--we tried to design them to be as general-purpose as possible. So, I think it's definitely a valid scenario to apply the environment variables and/or Docker context information. We should have some useful error messaging if volumes are used, since that will not work. In the meantime, as a workaround you may be able to use command customization as an alternative to the Regarding the task environment variables, that was for templating in environment variables in the task--e.g. you could use |
Hmm, I was able to work around this problem with Docker contexts and was able to debug remotely just fine, though admittedly it was TS and not Python or C#. Is there a reason that this shouldn't work or I should avoid it? I will admit that it was a bit of a pain to get setup because the system doesn't seem designed for debugging production docker images (like it doesn't specify It does look like command customization will be a much better fit for my needs than docker contexts, so thanks for that insight!
Ah, so there currently isn't any way to specify environment variables for the docker build/compose/run environment? That explains why none of those worked. Thanks for clearing that up. |
TypeScript (well, Node projects in particular) should work fine for debugging remotely as it does not use any volume mappings. We're currently looking into ways to reduce or eliminate the use of volume mapping in debugging, because it also is relevant for making debugging work in GitHub Codespaces--Python seems attainable but .NET is probably still far off. |
This is now released in Docker extension version 1.10.0. |
It appears that the
docker-build
task type is completely ignoringdocker.host
setting, as well asDOCKER_HOST
environment variable added to the task.What I Have Done
ssh -NL localhost:2376:/var/run/docker.sock -F C:\path\to\ssh\config user@host
.docker.host
setting totcp://localhost:2376
.What Works
docker -H tcp://localhost:2376 version
and get back server and client version information.DOCKER_HOST=tcp://localhost:2376 docker version
and get back server and client information.What Does Not Work
Trying to run this task results in an error like:
Failed Workarounds
"options": { "env": { "DOCKER_HOST": "tcp://localhost:2376" } },
to the task, but this did not resolve the issue."customOptions": "-H tcp://localhost:2376"
to thedockerBuild
object in the task, but this did not resolve the issue (it puts it in the wrong place, option must go afterdocker
and beforebuild
).What I Expected
I expected that setting
docker.host
would result in thedocker-build
task attempting to connect to the configureddocker.host
rather than trying to connect to a local docker daemon. I further expected that settingDOCKER_HOST
environment variable in the task configuration would cause docker to run using that environment and thus run against the remote host.Why I Am Doing it The Hard Way
ssh://
links in VSCode tools (like VSCode Remote and VSCode Docker) do not support custom SSH config paths and I do not have a workingConfig
at%USERPROFILE%/.ssh/config
. In some cases I can specify a custom SSH config file via configuration (like VSCode Remote - SSH) but in other tools like VSCode Docker I cannot, so I have to resort to creating an SSH tunnel and then using docker "locally".The text was updated successfully, but these errors were encountered: