Docker plug-in in vscode cannot connect

Time:2021-12-1

Docker plug-in in vscode cannot connect

Failed to connect. Is docker running
Error: connect EACCES /var/run/docker.sock

Cause analysis

The reason is that docker uses UNIX socket for communication, but UNIX socket belongs to root user, but ordinary users need to use sudo to enable root permission, but ordinary operations do not have root permission.

Solution

  1. Log in as root, but the security is not guaranteed
  2. Add ordinary users to docker group

    Sudo groupadd docker # add docker user group
    Sudo gpasswd - a $user docker # adds the current user to the docker user group
    Newgrp docker # update docker user group

Log in to vscode again after adding. After the user reconnects, the docker plug-in will run normally.

test

Can rundocker psCommand, if there is a normal output, it is normal.

Welcome to my personal blogximikang.icu

Recommended Today

Game case | application evolution and practice of service mesh in happy games

author Chen Zhiwei, Tencent level 12 background expert engineer, is now responsible for the public background technology research and development and team management of happy game studio. Rich experience in micro service distributed architecture and game background operation and maintenance research and development. preface The background of happy game studio is a distributed micro service […]