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...

Categories

Upcoming Training