首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >docker未授权:需要身份验证-成功登录后推送

docker未授权:需要身份验证-成功登录后推送
EN

Stack Overflow用户
提问于 2016-04-16 19:45:55
回答 28查看 228.6K关注 0票数 126

当从我的主机推送docker镜像(在成功登录后)时,我得到了“未授权:需要身份验证”。

详情见下文。

代码语言:javascript
复制
-bash-4.2# docker login --username=asamba --email=anand.sambamoorthy@gmail.com
WARNING: login credentials saved in /root/.docker/config.json
*Login Succeeded*
-bash-4.2#
-bash-4.2# docker push asamba/docker-whale

Do you really want to push to public registry? [y/n]: y
The push refers to a repository [docker.io/asamba/docker-whale] (len: 0)
faa2fa357a0e: Preparing
unauthorized: authentication required

存储库docker版本: 1.9.1 (客户端和server)

/var/log/messages显示403,我不知道这个docker。见下文。

代码语言:javascript
复制
Apr 16 11:39:03 localhost journal: time="2016-04-16T11:39:03.884872524Z" level=info msg="{Action=push, Username=asamba, LoginUID=1001, PID=2125}"
Apr 16 11:39:03 localhost journal: time="2016-04-16T11:39:03.884988574Z" level=error msg="Handler for POST /v1.21/images/asamba/docker-whale/push returned error: Error: Status 403 trying to push repository asamba/docker-whale to official registry: needs to be forced"
Apr 16 11:39:03 localhost journal: time="2016-04-16T11:39:03.885013241Z" level=error msg="HTTP Error" err="Error: Status 403 trying to push repository asamba/docker-whale to official registry: needs to be forced" statusCode=403
Apr 16 11:39:05 localhost journal: time="2016-04-16T11:39:05.420188969Z" level=info msg="{Action=push, Username=asamba, LoginUID=1001, PID=2125}"
Apr 16 11:39:06 localhost kernel: XFS (dm-4): Mounting V4 Filesystem
Apr 16 11:39:06 localhost kernel: XFS (dm-4): Ending clean mount
Apr 16 11:39:07 localhost kernel: XFS (dm-4): Unmounting Filesystem

任何帮助,请让我知道,如果您需要进一步的信息。我也用-f做了推送。不走运!

EN

回答 28

Stack Overflow用户

回答已采纳

发布于 2016-04-16 20:27:05

好的!不要紧,我已经找到解决方案了。403怀疑HTTP不会到达正确的URL。

将存储有登录凭据的文件的~/.docker/config.json从默认生成的

代码语言:javascript
复制
{
        "auths": {
                "docker.io": {
                        "auth": "XXXXXXXXXXXXX",
                        "email": "x.y@gmail.com"
                }
        }
}

to -注意docker.io -> index.docker.io/v1的更改。这就是变化。

代码语言:javascript
复制
{
        "auths": {
                "https://index.docker.io/v1/": {
                        "auth": "XXXXXXXXXXXXX",
                        "email": "x.y@gmail.com"
                }
        }
}

希望这能有所帮助。

注意auth字段应该是‘username:password’base64编码。例如:"username:password“base64编码是"dXNlcm5hbWU6cGFzc3dvcmQ=”。

因此,您的文件将包含:

代码语言:javascript
复制
"auth": "dXNlcm5hbWU6cGFzc3dvcmQ="
票数 35
EN

Stack Overflow用户

发布于 2016-09-22 02:54:32

您需要登录到Docker。

第1步:登录到docker hub

根据@KaraPirinc的评论,在Docker版本17中,为了登录:

代码语言:javascript
复制
docker login -u username --password-stdin

然后在系统提示时输入您的密码。

步骤2:在docker hub中创建存储库。

比方说"mysqlserver:sql".

代码语言:javascript
复制
docker push <user username>/mysqlserver:sql
票数 103
EN

Stack Overflow用户

发布于 2016-04-29 21:28:28

你发布的解决方案对我不起作用...

以下是对我有效的方法:

  1. 使用所需的名称创建存储库。
  2. 在提交镜像时,将镜像命名为与存储库相似的名称,包括用户名<dockerusername>/desired-name。例如,radu/desired-name.
票数 34
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36663742

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档