报错 permission denied
ERROR: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Head "http://%2Fvar%2Frun%2Fdocker.sock/_ping": dial unix /var/run/docker.sock: connect: permission denied
The terminal process "/usr/bin/bash '-c', 'docker build --pull --rm -f "Dockerfile" -t 4dsegment3:jzheng0 "."'" failed to launch (exit code: 1).
Terminal will be reused by tasks, press any key to close it.
处理
The error message indicates that your user does not have the necessary permissions to access the Docker daemon. To resolve this, you can add your user to the docker group and then restart your session. Here are the steps:
Add your user to the docker group:
sudo usermod -aG docker $USER
Restart your session:
Log out and log back in, or
Restart your computer, or
Use the following command to start a new shell with the updated group
newgrp docker
membership:
After performing these steps, try running the docker build command again.