Problem scenario
You are trying to log into a Docker registry but you get this message:
"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.29/auth: dial unix /var/run/docker.sock: connect: permission denied"
You know the credentials are correct. What is wrong?
Root cause
It could be that your user account is not a member of the "docker" group on the Linux system. Despite being challenged for a username and password, this message is not about authentication with the Docker registry server. It pertains to the user not being a member of the "docker" group.
Possible Solution #1 (recommended)
Add the Linux user trying to run the "docker login" command to the "docker" group. You may need to reinstall Docker to work without a "sudo " command; if you need assistance with this, see this posting.
Possible Solution #2 (very inadvisable and only acceptable in rare instances)
When you run "docker login https://x.x.x.x" use "sudo" in front of it like this:
sudo docker login https://x.x.x.x
You could be root and run docker login https://x.x.x.x
but this is inadvisable like the sudo
alternative above. Assuming you are the jdoe user, you could run a command like this to add it to the "docker" group: sudo usermod -aG docker jdoe
Possible Solution #3
The credentials you were using were actually incorrect. Get known working credentials and try again.