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

Default config for attaching to containers #3585

Closed
smhc opened this issue Aug 27, 2020 · 3 comments
Closed

Default config for attaching to containers #3585

smhc opened this issue Aug 27, 2020 · 3 comments
Assignees
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality plan-review PM-highlighted item determined to be P1 or P2
Milestone

Comments

@smhc
Copy link

smhc commented Aug 27, 2020

The SSH remote extension runs the extension host using a login shell, which sources in .profile and .kshrc. This sets up the runtime environment correctly for extensions that depend on environment variables.

However the container/docker extension simply uses 'docker exec' when attaching to existing containers, and this does not run a login shell. Consequently any extensions started do not have a correct environment and commonly fail.

e.g vscode appears to run the following to run the host:

docker exec -i -u myuser -e VSCODE_REMOTE_CONTAINERS_SESSION=53627264-3da6-420b-ab74-afdd4810f4381598533888068 5b88c83c230b456e4489a112998a1651dc7c6c936c39d3e9c812d221c5606da6 /home/myuser/.vscode-server-insiders/bin/b58f4549b2919fa3a5dc52df83f4ba60780c625f/node -e 

I would like it to run the following instead:

docker exec -i -u myuser -e VSCODE_REMOTE_CONTAINERS_SESSION=53627264-3da6-420b-ab74-afdd4810f4381598533888068 5b88c83c230b456e4489a112998a1651dc7c6c936c39d3e9c812d221c5606da6 /usr/bin/ksh -lc "/home/myuser/.vscode-server-insiders/bin/b58f4549b2919fa3a5dc52df83f4ba60780c625f/node -e "

Note the addition of '/usr/bin/ksh -lc'. This would ideally use the 'automationShell' setting when invoking node.

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Aug 27, 2020
@smhc
Copy link
Author

smhc commented Aug 28, 2020

I see the new undocumented option pretty much does what I am describing above:

{
	"userEnvProbe": "loginInteractiveShell"
}

However this needs to be set per container name/image. It would be great if we could specify a default for all attached containers - in my situation the image and the container name regularly change but the connection method stays the same.

Is there a 'default attached devcontainer.json' setting somewhere?

Or perhaps something we can do in our container/image to specify which type of 'env probe' we want? e.g a docker ENV variable, or even a naming standard of the container?

@chrmarti chrmarti self-assigned this Aug 28, 2020
@chrmarti chrmarti added the feature-request Request for new features or functionality label Aug 28, 2020
@chrmarti chrmarti changed the title Support using login shell for extension host running in attached containers Default config for attaching to containers Nov 9, 2020
@bamurtaugh bamurtaugh added the plan-review PM-highlighted item determined to be P1 or P2 label Nov 20, 2020
@Chuxel
Copy link
Member

Chuxel commented Jun 8, 2021

@chrmarti I think this is covered under the 1.57 release, correct?

@chrmarti
Copy link
Contributor

chrmarti commented Jun 8, 2021

There is no setting, but the default is now "userEnvProbe": "loginInteractiveShell". Closing as fixed, thanks.

@chrmarti chrmarti closed this as completed Jun 8, 2021
@chrmarti chrmarti added this to the May 2021 milestone Jun 8, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality plan-review PM-highlighted item determined to be P1 or P2
Projects
None yet
Development

No branches or pull requests

4 participants