Welcome to the Linux Foundation Forum!

Error in the setup for "permission denied while trying to connect to the docker API"

While doing the setup and following the first video, I am facing this problem. Because I removed the docker from my machine and solely relying on WSL and VSCode Dev container plugin, I am not able to create the userGroup and add current user to this group.

I am stuck here and not able to proceed further on training.

{"Client":{"Platform":{"Name":"Docker Engine - Community"},"Version":"29.5.3","ApiVersion":"1.54","DefaultAPIVersion":"1.54","GitCommit":"d1c06ef","GoVersion":"go1.26.4","Os":"linux","Arch":"amd64","BuildTime":"Wed Jun 3 18:00:12 2026","Context":"default"},"Server":null}
[27557 ms] permission denied while trying to connect to the docker API at unix:///var/run/docker.sock

Answers

  • fazlur.khan
    fazlur.khan Posts: 73

    Hello @abhishekforotel ,

    Couple of observations...
    1. Server:null in your output suggests, that CLI cannot talk to server... either its not running or not reachable... can you try to restart the service? sudo service docker start or sudo dockerd . Usually in WSL2 without Docker Desktop, the deamon doesnt autostart...
    2. What is the error while creating the group? if you are not able to, then simply try the docker command as root with sudo, for example sudo docker container ls
    3. To create the group try the commands - sudo groupadd docker && sudo usermod -aG docker $USER
    after that do a fresh login as the useradd dosent apply to current shell.

    Let me know how it goes...

  • Dear @fazlur.khan

    Thanks for responding. I tried restarting the VS Code multiple times but the problem remains same each time. As I have already un-installed all docker related softwares from my system for starting the lab, I don't have any docker service running on my system. (it is windows 11 Home Edition).

    While I tried doing the sudo commands, I am getting command not found even after installing the sudo using npm install sudo.

    Can you please help me guiding from very basic as I am little new to this field.

    Thanks

Categories

Upcoming Training