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

Issue attaching VS code to a docker container #4893

Closed
altjx opened this issue Apr 16, 2021 · 5 comments
Closed

Issue attaching VS code to a docker container #4893

altjx opened this issue Apr 16, 2021 · 5 comments
Assignees
Labels
containers Issue in vscode-remote containers info-needed Issue requires more information from poster

Comments

@altjx
Copy link

altjx commented Apr 16, 2021

  • VSCode Version: 1.55.2
  • Local OS Version: macOS Big Sur 11.2.3
  • Remote OS Version: Amazon Linux 2
  • Remote Extension/Connection Type: SSH/Docker/WSL: Remote Containers v0.166.1 / connecting via SSH with a docker container on the remote server
  • Logs: Error running command remote-containers.attachToRunningContainerFromViewlet: Running the contributed command: 'remote-containers.attachToRunningContainerFromViewlet' failed.. This is likely caused by the extension that contributes remote-containers.attachToRunningContainerFromViewlet.

Steps to Reproduce:

  1. Open VS Code
  2. Connect to a remote host via SSH
  3. In the "Docker" extension, find the docker container that's currently running
  4. Right click the docker container -> Attach Visual Studio Code
  5. The little prompt comes up (as if you're hitting cmd + shift + p) and quickly goes away, followed by the error

I haven't been able to reproduce this on my Ubuntu 20.04 server, so I'm wondering if this is actually something related to the OS. The error message indicates that this is likely caused by the extension, howeverr.

Here's another issue that seems to be related to mine, but theirs was closed since it didn't provide enough information

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Apr 16, 2021
@chrmarti
Copy link
Contributor

chrmarti commented Apr 16, 2021

Could you append the log when fails? (F1 > Remote-Containers: Show Log)

@chrmarti chrmarti self-assigned this Apr 16, 2021
@chrmarti chrmarti added the info-needed Issue requires more information from poster label Apr 16, 2021
@altjx
Copy link
Author

altjx commented Apr 16, 2021

Ahh, I see @chrmarti. I'm getting this:

[3 ms] Remote-Containers 0.166.1 in VS Code 1.55.2 (3c4e3df9e89829dce27b7b5c24508306b151f30d).
[11492 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[11600 ms] 
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[11601 ms] Start: Run: docker ps -q
[34237949 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[34238073 ms] 
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[34238075 ms] Start: Run: docker ps -q

I'm actually root on the server and docker is indeed running. Any thoughts?

[root@ip-x-x-x-x ~]# service docker status
Redirecting to /bin/systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2021-03-29 20:54:34 UTC; 2 weeks 3 days ago
     Docs: https://docs.docker.com
 Main PID: 3497 (dockerd)
    Tasks: 23
   Memory: 2.9G
   CGroup: /system.slice/docker.service
           ├─ 3497 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --default-ulimit nofile=1024:4096
           └─31470 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3000 -container-ip 172.17.0.2 -container-port 3000

Mar 30 23:06:35 ip-x-x-x-x.ec2.internal dockerd[3497]: time="2021-03-30T23:06:35.158878529Z" level=info msg="Container 45b313022462299abb0f4290244f62e24fa43e17308685b9ba7f277d71c99253 failed to exit within 30 seconds of signal 15 - using the force"
Mar 30 23:06:35 ip-x-x-x-x.ec2.internal dockerd[3497]: time="2021-03-30T23:06:35.340575485Z" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Apr 02 02:13:07 ip-x-x-x-x.ec2.internal dockerd[3497]: time="2021-04-02T02:13:07.034860579Z" level=error msg="Error running exec d4998d7ec14867bf8047775b73f76bc7ab5fbf78d3244a3b1d992eed1bff5677 in container: exec attach failed: error attaching stdout stream: write unix /var/run/docker.sock->@: write: broken pipe"
Apr 05 00:05:59 ip-x-x-x-x.ec2.internal dockerd[3497]: time="2021-04-05T00:05:59.274141470Z" level=info msg="Container e3c2f21456193827494d1459bab479310e032108e0b45c58b01727515c1e20bd failed to exit within 30 seconds of signal 15 - using the force"
Apr 05 00:05:59 ip-x-x-x-x.ec2.internal dockerd[3497]: time="2021-04-05T00:05:59.489324522Z" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Apr 12 10:34:56 ip-x-x-x-x.ec2.internal dockerd[3497]: time="2021-04-12T10:34:56.940124332Z" level=info msg="Attempting next endpoint for pull after error: manifest unknown: Requested image not found"
Apr 12 10:34:58 ip-x-x-x-x.ec2.internal dockerd[3497]: time="2021-04-12T10:34:58.190118861Z" level=info msg="Attempting next endpoint for pull after error: manifest unknown: Requested image not found"
Apr 12 10:35:00 ip-x-x-x-x.ec2.internal dockerd[3497]: time="2021-04-12T10:35:00.778017068Z" level=info msg="Attempting next endpoint for pull after error: manifest unknown: Requested image not found"
Apr 12 10:35:05 ip-x-x-x-x.ec2.internal dockerd[3497]: time="2021-04-12T10:35:05.665509227Z" level=info msg="Attempting next endpoint for pull after error: manifest unknown: Requested image not found"
Apr 12 10:35:11 ip-x-x-x-x.ec2.internal dockerd[3497]: time="2021-04-12T10:35:11.378975635Z" level=info msg="Attempting next endpoint for pull after error: manifest unknown: Requested image not found"

The interesting thing is that I can run this exact same command without getting an error:

[root@ip-x-x-x-x bin]# docker version --format {{.Server.APIVersion}}
1.40

@altjx
Copy link
Author

altjx commented Apr 16, 2021

I was able to get this working. I had to open a folder on the remote server, and then attach VS code to a container. I guess the extension was trying to use docker locally until I connected to a remote folder.

Is this a bug?

The extension should know that if I'm connected via SSH, and the Docker extension can clearly pull up the containers/images on the remote SSH server, shouldn't "Attach VS Code" also understand that I'm trying to attach to a remote container? Instead, it's trying to run docker on my local system, which results in that error.

I don't think I should have to open a folder on the remote SSH server for the Remote Containers extension to know that I'm trying to attach VS Code to a container running on the remote server.

@abidrahmank
Copy link

Hi @altjx I ran into the same issue. My log shows following:

[299706 ms] Start: Run: docker version --format {{.Server.APIVersion}}
[299751 ms] findLocalWindowsExecutable: Exectuable 'docker' not found on PATH 'C:\Program Files (x86)\Common File........'

VSCode : 1.55.2
My local OS : Windows 10
My remote OS : Ubuntu 18.04

What do you mean by I had to open a folder on the remote server, and then attach VS code to a container ?
I opened a directory in remote server and I still see the same error. Let me know if I am missing something here.

@chrmarti
Copy link
Contributor

@abidrahmank Try File > Open Folder in the Remote-SSH window and then retry attaching to the container.

This is a duplicate of #4913. Continuing tracking there.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 6, 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 info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants