Add the docker user group and execute the command:
sudo groupadd docker
Add the current common user to the docker user group and execute the command:
sudo usermod -aG docker ${USER}
If you execute docker pull at this time, you will still be prompted as follows:
Using default tag: latest
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromImage=mysql&tag=latest": dial unix /var/run/docker.sock: connect: permission denied
You need to modify the execution permission of /run/docker.sock and execute the command:
sudo chmod a+rw /var/run/docker.sock
Finally, restart docker, execute the command:
systemctl restart docker
After executing the above series of commands, docker pull can be executed
Validation results:
docker pull mysql