Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VsCode Dev Containers + Rootless Docker = Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Wondering if anyone has been able to overcome this error message in Visual Studio Code while using the Dev Containers extension and Rootless Docker:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Exact output from Visual Studio Code:

enter image description here

Environment:

  • Ubuntu 22.04.3 LTS
  • Visual Studio Code 1.85.1
  • Docker Engine Community 24.0.7

What I have tried:

  • Set the DOCKER_HOST environment variable in /etc/profile.d/my_env_vars.sh (I made sure to re-login after setting the variable): export DOCKER_HOST=unix:///run/user/1000/docker.sock

  • Create a symlink to /run/user/1000/docker.sock: ln -s /run/user/1000/docker.sock /var/run/docker.sock

  • Install the VsCode Docker extension then set the DOCKER_HOST variable to: unix:///run/user/1000/docker.sock

  • Verify Docker is operational: docker run hello-world

    Hello from Docker! This message shows that your installation appears to be working correctly.

    To generate this message, Docker took the following steps:

    1. The Docker client contacted the Docker daemon.
    2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64)
    3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading.
    4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.
  • Verify the Active Context: docker context ls

enter image description here

Thanks for your help.

like image 808
fire_water Avatar asked Dec 06 '25 13:12

fire_water


1 Answers

Not sure if it will fix your problem, but I had a similar issue. What resolved it was the following (not sure which step actually fixed the issue):

  • Upgrading vscode from 1.77.3 to 1.85.1 (probably not related considering your version)
  • Reloading some extensions especially Remote - SSH
  • Updating all packages sudo apt update && sudo apt upgrade

Hope this helps.

like image 94
Rumengol Avatar answered Dec 08 '25 09:12

Rumengol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!