Skip to content

Agent: allow SSH+rpty to running devcontainer #16419

Closed
@johnstcn

Description

@johnstcn

Normally when starting a rPTY or SSH session, we simply execute the user's shell.

Given a container ID or name, allow running the equivalent of docker exec -i <container_name> <shell> instead of just <shell>.

Some considerations:

  • We will have to determine the default shell of the container user. Something like getent passwd | grep $(whoami) | cut -d : -f 7
  • If determining the default shell does not work, we may wish to fall back to /bin/sh.
  • We will default to the 'default user' of the container. We may later wish to allow the option to specify the desired container user.
  • For SSH, we should allow specifying the container via hostname (for example, workspace.agent.container)
  • If the requested container is not found, we could return an error and show the available containers. (Note: this is a usability improvement over kubectl exec, which simply states the non-existence of the requested container).
  • If the requested container is not running (crashed?), we should show a distinct error to the above.

For now, only support Docker via docker CLI.

Note from Spike:

In the case of SSH, we probably need to do a little more research into the protcol, so that we can figure out how the agent will be able to tell the difference between an SSH session for the outer container and the dev container. One possibility is that it won’t have to care and it’s just an SSH session where it immediately shells out to docker exec.

Increasing complexity estimate by 1 (3->4) based on the above.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions