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

Investigate attaching to container when connected with Remote-SSH #4072

Closed
chrmarti opened this issue Nov 24, 2020 · 9 comments
Closed

Investigate attaching to container when connected with Remote-SSH #4072

chrmarti opened this issue Nov 24, 2020 · 9 comments
Assignees
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@chrmarti
Copy link
Contributor

Following up on an earlier discussion. /cc @bamurtaugh

@chrmarti chrmarti added containers Issue in vscode-remote containers feature-request Request for new features or functionality labels Nov 24, 2020
@chrmarti chrmarti added this to the November 2020 milestone Nov 24, 2020
@chrmarti chrmarti self-assigned this Nov 24, 2020
@chrmarti
Copy link
Contributor Author

chrmarti commented Nov 24, 2020

Got it working with the following limitations:

An easy to configure performance improvement is #3938.

@PavelSosin-320
Copy link

@chrmarti Docker engine is only a secured server. The correct DOCKER_HOST doesn't promise connectivity. Port 2375 and no-tls are not the default.
In any place in VS Code dev-container documentation I have found which SSH version and the user should be used when working with remote Docker engine via SSH. It can't be any user. On one hand, this user must belong to the Docker User Group to fulfill Docker security requirements. On another hand, it can't be the root user because Linux prohibits remote root access due to safety common sense.
Also using SSH version is not obvious because Docker engine v 19.03 doesn't serve REST API with SSL on port ssh://host:2376, but only TLS 1.1 as it is mentioned in dockerd documentation (Is Windows OpenSSH compatible? The same version Docker CLI 19.03 is OK ! ) It can be changed to TLS 1.3 any day if Docker Linux package providers will need network security compliance from Cloud / Enterprise infrastructure providers. Ubuntu LTS 18.04, 20.04, and CentOS 7,8 have passed this point.

@chrmarti chrmarti added the verification-needed Verification of issue is requested label Dec 1, 2020
@chrmarti chrmarti closed this as completed Dec 1, 2020
@JacksonKearl
Copy link
Contributor

Hey how can we verify this?

@JacksonKearl JacksonKearl added the verification-steps-needed Steps to verify are needed for verification label Dec 4, 2020
@chrmarti
Copy link
Contributor Author

chrmarti commented Dec 7, 2020

You need an SSH server with Docker installed. If you don't have one you can (works on Mac / Linux, I need to check on Windows):

  • If you don't have an ~/.ssh/id_rsa yet:
    • ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  • Checkout microsoft/vscode-remote-containers
  • cd dind, docker-compose up -d --build sshd-ubuntu
  • Check you can ssh in without password:
    • ssh-add ~/.ssh/id_rsa
    • ssh root@localhost -p 2222

Once you have an SSH server with Docker installed:

  • Use Remote-SSH to connect to it (e.g., root@localhost:2222).
  • In the Remote-SSH session, start a new container: docker run -d debian sleep infinity
  • From the Remote-Explorer viewlet, verify you can attach to that new container.

@chrmarti chrmarti removed the verification-steps-needed Steps to verify are needed for verification label Dec 7, 2020
@lszomoru
Copy link
Member

lszomoru commented Dec 7, 2020

Thanks @chrmarti. I am looking at this one now.

@lszomoru
Copy link
Member

lszomoru commented Dec 7, 2020

@chrmarti, I am not seeing the newly started container in the Remote Explorer viewlet:
image

@lszomoru lszomoru added the verification-found Issue verification failed label Dec 7, 2020
@chrmarti
Copy link
Contributor Author

chrmarti commented Dec 7, 2020

@lszomoru I forgot: You need to open a folder on the SSH server. (tracked with microsoft/vscode#111371)

@chrmarti chrmarti removed the verification-found Issue verification failed label Dec 7, 2020
@lszomoru
Copy link
Member

lszomoru commented Dec 7, 2020

@chrmarti, now I see the container but when I try to attach I get in this loop as the container does not seem to be running:
image

@lszomoru lszomoru added the verification-found Issue verification failed label Dec 7, 2020
@chrmarti
Copy link
Contributor Author

chrmarti commented Dec 7, 2020

@lszomoru My bad, you need to start it with a process that keeps running: docker run -d debian sleep infinity

@chrmarti chrmarti removed the verification-found Issue verification failed label Dec 7, 2020
@lszomoru lszomoru added the verified Verification succeeded label Dec 7, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 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 verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants