Cannot login to Docker account

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?

131281 次浏览

我在 ubuntu 18.08中也遇到过同样的问题,最终这个解决方案作为一个临时的解决方案对我起作用了。

我创建了这个文件夹 home/.docker/,因为一些解决方案建议我创建一个文件 config.json,并在其中写入默认凭据。

{
"credsStore": "pass"
}
  • 我删除了这个文件 config.json
  • 然后将 docker-credential-secret service 重命名为另一个名称,这样它就不会拾取这个文件。

    Sudo mv/usr/bin/docker-credential-secret service/usr/bin/docker-credential-secret service _ x

成功了!

在 ubuntu 中安装以下软件包解决了我的问题

sudo apt install gnupg2 pass

编辑2019-04-07:

由于这是目前选择的答案,我认为人们应该尝试@Anish Varghese 解决方案下面第一,因为它似乎是最容易的。 您只需要安装 gnupg2并传递包:

Sudo apt install gnupg2 pass

如果不行,你可以试试我原来的方法:

我也有同样的问题。Bak2trak 的答案工作,但它保存了明确的文本凭据。如果你想把它们保存在密码库中,这里有一个解决方案。

1)从 https://github.com/docker/docker-credential-helpers/releases下载 docker-credential-pass

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

3) chmod u+x docker-credential-pass

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

5)您需要设置 docker-credential-pass (以下步骤基于 https://github.com/docker/docker-credential-helpers/issues/102#issuecomment-388634452)

5.1)安装 gpg 和 pass (apt-get install gpg pass)

5.2) gpg --generate-key,输入你的信息。你应该看到这样的东西:

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

收到123号线

5.3) pass init 1234567890ABCDEF1234567890ABCDEF12345678(粘贴)

5.4) pass insert docker-credential-helpers/docker-pass-initialized-check及设定 下一个密码“ pass is initialization”(没有引号)。

5.5) pass show docker-credential-helpers/docker-pass-initialized-check。您应该看到传递已初始化。

5.6) docker-credential-pass list

6)使用以下命令创建一个 ~/. docker/config.json:

{
"credsStore": "pass"
}

7)码头登录现在应该工作

注意: 如果在以后的运行中出现“ pass store is uninitialization”错误,请运行以下命令(它将重新加载内存中的 pass store) :

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

它将询问您的密码并初始化通行证存储。

这是基于以下讨论: Https://github.com/moby/moby/issues/25169#issuecomment-431129898

对我来说 docker push失败了

denied: requested access to the resource is denied

... 所以我想要 docker login但是在输入证件之后得到了以下信息:

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

幸运的是,我有另一台机器可用,我可以登录而不需要对系统做任何更改。我复制了 ~/.docker/config.json的内容。

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

... 到另一台机器和 docker push工作。

对我来说,最简单的解决方案是在用户主目录的. docker 目录下创建 config.json 文件:

/home/. docker/config.json

然后我从服务器上复制了这个文件的内容,从那里我可以登录到 docker hub。

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


}

这是一个简单的解决方案,因为它不需要您安装或更新任何软件包,我们不能轻松地在生产服务器上做。

在 ubuntu 中安装以下软件包

sudo apt install gnupg2 pass

这招对我很管用。

如果 apt install gnupg2 pass 不适合您,您还可以安装 golang-docker-credential-helpers 包

你已经读过解决方案了,但事实是 gnupg2现在没有默认安装在 Ubuntu 18 + 中,这就是为什么在 apt upgrade之后的某个时候,事情的表现有点不同。

在回答之后,我有几个问题。

  1. 关键的一代停留在熵(步骤5.2)。

幸运的是,这个修复很简单,您只需要安装软件包 rng-tools: https://stackoverflow.com/a/32941065

  1. pass init <key>(步骤5.3)上出现了错误 gpg: decryption failed: No secret key

事实上,这个问题是由于密钥被限制为 root 特权造成的。

我更改了用户家庭目录中 .gnupg .password-store文件夹的所有权。

然后重新加载 dirmngr,以避免“不安全的所有权”警告:

gpgconf --kill dirmngr

如果您不想完成所有这些操作,可以以 root/sudo 的形式运行所有命令。

创造了下面这个解决了我的问题:

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

这可能也有帮助,至少在 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

简单的解决方案: 只需从 ~/. docker/config.json 中删除 "credsStore": "secretservice"

你没有证件商店。尝试使用 Gnome Keyring; 根据您的 Linux 安装,它可能已经安装了。您也可以使用 GK 在 Chrom { e,ium }(可能还有更多)中安全地存储认证数据。回到多克,你需要一个。Docker/config.json 类似:

{
"credsStore": "secretservice"
}

然后,确保已经将 PAM 配置为解锁密匙环: https://wiki.archlinux.org/index.php/GNOME/Keyring#PAM_method

我有这个问题(无头 Ubuntu20,从16,18升级) ,其他的答案对我都不起作用。最后,在阅读了这里发布的一些讨论之后,我发现问题在于 Gnome-keyring已经安装,但是没有正常工作。因为这是一个 headless,所以正确的答案是删除 gnome-keyring (因为它提供了 Org.freedesktop.secret服务) ,然后它就完美地工作了。

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

我刚刚删除了 ~/. docker/config.json 并再次尝试登录。

在我的例子中,这个错误是在给予所有用户对文件/var/run/docker.sock 的读写权限之后解决的:

sudo chmod 666 /var/run/docker.sock

通过使用 sudo 运行脚本,我解决了这个问题!

sudo docker login -u YOU-USERNAME

试试看: sudo apt install golang-docker-credential-helpers

在我的 Ubuntu 18中这样做:

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

sudo apt install gnupg2 pass对我来说不起作用,我每次使用 docker 时都没有在前面添加 sudo,所以我添加了 sudo docker login -u <myusername> 它提示我通过,这一次它工作,因为我使用我的码头 sudo。

对我来说,卸载包 docker-compose并手动安装一个更新的版本解决了这个问题。

卸载的码头-组成:

sudo apt remove docker-compose

安装了更新的版本,如下所示 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