168
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?

3
  • I ran into a somewhat similar problem today while trying to run docker login from within a LXD/LXC container. That particular one I solved by copying .docker/config.json from my host over to my $HOME/.docker/ directory within the LXD/LXC container, which I created manually. I'm currently trying to figure out another issue now, but wanted to ask if you had you tried doing this yet?
    – code_dredd
    May 9, 2018 at 22:07
  • No, I sort of gave up on Windows. I am getting a new laptop tomorrow, where I will be installing Ubuntu 18 as a dual boot. May 9, 2018 at 22:12
  • I have opened up an issue for this here github.com/docker/cli/issues/1136. If they find a solution for this, I'll post it here.
    – thishandp7
    Jun 21, 2018 at 9:26

22 Answers 22

316

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

6) create a ~/.docker/config.json with:

{
"credsStore": "pass"
}

7) 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

11
  • 1
    Didn't work for me. I get the message when I try docker login: "error getting credentials - err: exit status 1, out: `pass store is uninitialized" Oct 29, 2018 at 13:02
  • I started again after uninstalling pass and deleting the .password-store folder. Seems better now. Thanks. Oct 29, 2018 at 13:43
  • 3
    @Jean-Phillipe Jodoin, thanks. It seems I have to call this periodically otherwise the login call fails to find the credentials. I read this might be something to do with the gpg cache expiring and the "pass show" wakes it up. When the server reboots I have to go back to the "pass insert" step before things work. It's not very convenient but it is allowing me to proceed. Oct 30, 2018 at 15:08
  • 2
    Check the answer by Anish Varghese below, it seems to be the easiest and cleanest solution.
    – Aurelien
    Nov 22, 2018 at 2:58
  • 1
    @JoePhillips: Agreed with you. Integrated his solution with citation. Apr 7, 2019 at 12:01
287

Install the following Packages in ubuntu fixed my issue

sudo apt install gnupg2 pass
10
  • 5
    didn't work for me, but also installing gpg worked: "sudo apt install gnupg2 pass gpg" Dec 29, 2018 at 17:27
  • 6
    Worked for me on ubuntu 18.04 too. I only issued sudo apt install pass, the rest came as its dependencies
    – Álex
    Mar 21, 2019 at 15:09
  • 4
    Worked for me on Unbuntu 18.04.
    – Gill Bates
    Jul 13, 2019 at 17:39
  • 14
    What is the root of the problem? and why how gnupg2 pass will fix the problem?
    – Phoenix
    Dec 9, 2019 at 4:55
  • 1
    Worked for me at ubuntu 19.04 too Mar 24, 2020 at 22:11
52

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!

8
  • 2
    @Renrhaf First docker by default looks for "pass" where it searches in gnome key-chain and osx-keychain in OS-X . If it's not found then looks for org.freedesktop.secrets. Its not found for ubuntu 18 (some issues). After renaming it (docker-credential-secretservice) to something else then it falls back to create config file by itself, You can look in home/.docker folder one config.json file would have been created.
    – bak2trak
    May 29, 2018 at 5:08
  • 1
    I just encountered this issue and solved it via this method - kind of. I installed docker-credential-secretservice from GH, created a ~/.docker/config.json with content as above then tried to log in. Got an error. Then deleted the .docker folder, config.json and the /usr/bin/docker-credential-secretservice executable and then ran docker login again with success
    – Andy
    Jul 6, 2018 at 6:25
  • 2
    To anyone having the same issue: Don't forget to delete config.json . I almost gave up on this, but it worked in the last moment, after I deleted config.json.
    – sr9yar
    Aug 13, 2018 at 19:39
  • 2
    For me, I uninstalled docker-compose and then ran your sudo mv /usr/bin/docker-credential-secretservice /usr/bin/docker-credential-secretservice_x rename, it worked. Does anyone know what docker-credential-secretservice is used for?
    – WSBT
    Sep 7, 2018 at 21:14
  • 1
    This solution worked for me, but it saves credentials base 64 encoded. I posted below a solution which uses pass. stackoverflow.com/questions/50151833/… Oct 18, 2018 at 19:29
12

This work for me in my Ubuntu 18:

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

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

1
  • I tried everything else in this thread and the only thing that worked for me was this one. Jan 20, 2022 at 20:43
9

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

7

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

7

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
1
  • Thanks. Removing gnome-keyring was enough - removing golang-docker-credential-helpers would mean to remove docker-compose, too.
    – Michael2
    Dec 4, 2021 at 20:30
6

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.

3
  • Sadly, this is the only workaround that has worked for me... at least it's possible to use an access token instead of your account's pwd. Sep 21, 2019 at 14:32
  • The path "~/home/.docker/config.json" seems so wrong. You probably meant "~/.docker/config.json"
    – BlakBat
    Jul 24, 2020 at 15:56
  • Thanks for poinitng it out, upadated the path.
    – Mr Kashyap
    Jul 30, 2020 at 12:47
5

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

sudo docker login -u YOU-USERNAME
1
  • --ignore-depends=golang-docker-credential-helpers golang-docker-credential-helpers this should be run before this command to work
    – smrf
    Nov 24, 2021 at 19:48
4

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

1
  • 2
    It is a dangerous solution since in this way the password is stored unencrypted May 25, 2021 at 13:48
3

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.

2

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

1
  • One earlier answer already mentions this installation. What information does your answer add ?
    – XouDo
    May 6, 2021 at 10:41
1

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.

0

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.

0

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

0
0

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.

0

To me Ubuntu 20.04

sudo apt install golang-docker-credential-helpers

It is working

-1

For me, uninstalling the package docker-compose and manually installing a more recent version solved the issue.

Uninstalled docker-compose :

sudo apt remove docker-compose

Installed more recent version as indicated here https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-debian-10 :

sudo curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
-2

creating the following solved it for me:

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

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
-3

Install the following Packages in ubuntu

sudo apt install gnupg2 pass

This is worked for me.

1
  • 1
    This doesn't provide any addition to earlier answers with the same or better content. Dec 29, 2019 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.