Cannot login to Docker account

DockerAuthentication

Docker Problem Overview


OS: Ubuntu 18.04 Server
Docker 18.3 CE

I am logged onto the server, from my Windows 10 laptop, using a PuTTY SSH session.

I don't have Docker on my local Windows laptop, so all the work is done on the remote server.

I can execute all Docker commands, on the remote server, using the terminal session.

However, when I try to save my image to the Docker hub, when I try to login, using:

docker login

I get the following error message:

error getting credentials - err: exit status 1, out: `GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files`

I did not get any error messages, when I created my image on the remote server.

I also do not see a .docker folder in the related home directory on the remote server. Any ideas?

Docker Solutions


Solution 1 - Docker

Edit 2019-04-07:

As this is the currently selected answer, I think people should try @Anish Varghese solution below first as it seems to be the easiest. You only need to install the gnupg2 and pass packages: > sudo apt install gnupg2 pass

If it doesn't work, then you can try my original solution here:

I had the same issue. bak2trak answer worked, but it saved credentials in clear text. Here's the solution if you want to keep them in a password store.

  1. Download docker-credential-pass from https://github.com/docker/docker-credential-helpers/releases

  2. tar -xvf docker-credential-pass.tar.gz

  3. chmod u+x docker-credential-pass

  4. mv docker-credential-pass /usr/bin

  5. You will need to setup docker-credential-pass (following steps are based of https://github.com/docker/docker-credential-helpers/issues/102#issuecomment-388634452)

5.1) install gpg and pass (apt-get install gpg pass)

5.2) gpg --generate-key, enter your information. You should see something like this:

pub   rsa3072 2018-10-07 [SC] [expires: 2020-10-06]
      1234567890ABCDEF1234567890ABCDEF12345678

Copy the 123... line

5.3) pass init 1234567890ABCDEF1234567890ABCDEF12345678 (paste)

5.4) pass insert docker-credential-helpers/docker-pass-initialized-check and set the next password "pass is initialized" (without quotes).

5.5) pass show docker-credential-helpers/docker-pass-initialized-check. You should see pass is initialized.

5.6) docker-credential-pass list

  1. create a ~/.docker/config.json with:

    { "credsStore": "pass" }

  2. docker login should now work

Note: If you get the error "pass store is uninitialized" in future run, run the below command (it will reload the pass store in memory):

pass show docker-credential-helpers/docker-pass-initialized-check

It will ask your password and it will initialize the pass store.

This is based off this discussion: https://github.com/moby/moby/issues/25169#issuecomment-431129898

Solution 2 - Docker

Install the following Packages in ubuntu fixed my issue

sudo apt install gnupg2 pass

Solution 3 - Docker

I faced the same issue in ubuntu 18.08 and this finally worked for me.. as a temporary solution.

I had created this folder home/.docker/ as some solutions suggested me to create a file config.json and write default credentials in it i.e.

{
	"credsStore": "pass"
}
  • I deleted this file config.json.

  • Then renamed docker-credential-secretservice to something else so that it doesn't picks up this file.

    sudo mv /usr/bin/docker-credential-secretservice /usr/bin/docker-credential-secretservice_x

and it worked!

Solution 4 - Docker

This may help too, at least it did in Ubuntu 20.04:

wget https://github.com/docker/docker-credential-helpers/releases/download/v0.6.3/docker-credential-secretservice-v0.6.3-amd64.tar.gz && tar -xf docker-credential-secretservice-v0.6.3-amd64.tar.gz && chmod +x docker-credential-secretservice && mv docker-credential-secretservice /usr/local/bin/

https://hackernoon.com/getting-rid-of-docker-plain-text-credentials-88309e07640d ; https://github.com/docker/docker-credential-helpers/releases

Solution 5 - Docker

If apt install gnupg2 pass does not work for you, you can also install golang-docker-credential-helpers package

Solution 6 - Docker

For me the simplest solution was to create config.json file under .docker directory inside user home directory:

/home/.docker/config.json

Then i copied the content of this file from the server from where i was able to login to the docker hub.

{
        "auths": {
                "https://index.docker.io/v1/": {
                        "auth": "SOMEVALUE"
                }
        },
        "HttpHeaders": {
                "User-Agent": "Docker-Client/18.06.1-ce (linux)"
        }

}

Its a easy workaround, because it doesn't require you to install or update any package which we can't do easily on production servers.

Solution 7 - Docker

Simple solution: just remove "credsStore": "secretservice" from ~/.docker/config.json

Solution 8 - Docker

This work for me in my Ubuntu 18:

docker logout
mv ~/.docker/config.json ~/.docker/config_old.json
docker login

Solution 9 - Docker

For me docker push failed with

denied: requested access to the resource is denied

... so I wanted to docker login but got the following after entering credentials:

Remote error from secret service:
  org.freedesktop.DBus.Error.UnknownMethod:
  No such interface 'org.freedesktop.Secret.Collection' on object at path
  /org/freedesktop/secrets/collection/login

Error saving credentials:
  error storing credentials - err: exit status 1, out:
  No such interface 'org.freedesktop.Secret.Collection' on object at path
  /org/freedesktop/secrets/collection/login

Luckily, I had another machine available on which I was able to log in without any changes to the system. I copied the content of ~/.docker/config.json...

{
        "auths": {
                "https://index.docker.io/v1/": {
                        "auth": "<some-hash-value>"
                }
        },
        "HttpHeaders": {
                "User-Agent": "Docker-Client/18.09.2 (linux)"
        }
}

... to the other machine and docker push worked.

Solution 10 - Docker

I just deleted the ~/.docker/config.json and try the login again. It works. A new file is created.

Solution 11 - Docker

I had this problem (headless Ubuntu 20, upgraded from 16,18) and none of the other answers worked for me. Finally, after reading some of the discussions posted here I found the problem was that the gnome-keyring was installed but not working properly. Since this was a headless, the correct answer was to remove gnome-keyring (since it was providing the org.freedesktop.secrets service) and then it worked perfectly.

sudo apt remove gnome-keyring golang-docker-credential-helpers

Solution 12 - Docker

Well you already read solution but the fact is gnupg2 is now not installed by default in Ubuntu 18+, That is the reason sometime after apt upgrade , things behave a little differently.

Solution 13 - Docker

The problem for me were solved by running the script with sudo!

sudo docker login -u YOU-USERNAME

Solution 14 - Docker

Just Try it: sudo apt install golang-docker-credential-helpers

Solution 15 - Docker

Following the answer I had the several issues.

  1. The key generation was stuck at entropy (step 5.2).

Fortunately, the fix is easy and you only need to install the package rng-tools: https://stackoverflow.com/a/32941065

  1. On pass init <key> (step 5.3) the error gpg: decryption failed: No secret key showed up.

In fact this issue is due to the secret key being restricted to root privileges.

I changed the ownership of the .gnupg .password-store folders in my user's homedir.

Then reloaded the dirmngr to avoid "unsafe ownership" warning:

gpgconf --kill dirmngr

If you don't want to do all that you can run all commands of the answer as root/sudo.

Solution 16 - Docker

You don't have a credentials store. Try using Gnome Keyring; depending on your linux installation, it might already be installed. You can use GK to securely store auth data in Chrom{e,ium} (and probably more) too. Getting back to Docker, you'd need a .docker/config.json like:

{
    "credsStore": "secretservice"
}

Then, make sure you've configured PAM to unlock the keyring: https://wiki.archlinux.org/index.php/GNOME/Keyring#PAM_method

Solution 17 - Docker

sudo apt install gnupg2 pass wasn't working for me and I was using docker without adding sudo in front everytime. So I added sudo docker login -u <myusername> it prompted me the pass and this time it worked since I used sudo for my docker.

Solution 18 - Docker

creating the following solved it for me:

AWS_CONFIG=$AWS_DIR/config
AWS_CREDENTIALS=$AWS_DIR/credentials
mkdir -p $AWS_DIR

Solution 19 - Docker

In my case, this error was resolved after giving read and write access to all users to the file /var/run/docker.sock:

sudo chmod 666 /var/run/docker.sock

Solution 20 - Docker

Install the following Packages in ubuntu

sudo apt install gnupg2 pass

This is worked for me.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionEastsideDevView Question on Stackoverflow
Solution 1 - DockerJean-Philippe JodoinView Answer on Stackoverflow
Solution 2 - DockerAnish VargheseView Answer on Stackoverflow
Solution 3 - Dockerbak2trakView Answer on Stackoverflow
Solution 4 - DockerVlaxView Answer on Stackoverflow
Solution 5 - DockerJuanraView Answer on Stackoverflow
Solution 6 - DockerMr KashyapView Answer on Stackoverflow
Solution 7 - DockerMxWildView Answer on Stackoverflow
Solution 8 - DockerAleSBView Answer on Stackoverflow
Solution 9 - DockerCodeManXView Answer on Stackoverflow
Solution 10 - DockerTiago NogueiraView Answer on Stackoverflow
Solution 11 - DockerbriandrawertView Answer on Stackoverflow
Solution 12 - DockeroctamoisView Answer on Stackoverflow
Solution 13 - DockerAalejandro Martinez RodriguezView Answer on Stackoverflow
Solution 14 - DockerShamil QurbonovView Answer on Stackoverflow
Solution 15 - Dockerv0idView Answer on Stackoverflow
Solution 16 - DockerNate SymerView Answer on Stackoverflow
Solution 17 - DockerAmeer Ul IslamView Answer on Stackoverflow
Solution 18 - DockerDanletskiView Answer on Stackoverflow
Solution 19 - DockerVlad-Marius GrigutaView Answer on Stackoverflow
Solution 20 - DockerVirani ChetanView Answer on Stackoverflow