当前位置: 首页 > 面试题库 >

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

江宏放
2023-03-14
问题内容

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

详细信息如下。

-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(客户端和服务器)
  • http://hub.docker.com也创建了存储库(asamba / docker-whale)。

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

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进行了推送。没运气!


问题答案:

好!没关系; 我找到了解决方案。403怀疑HTTP不能到达正确的URL。

更改已将登录凭据存储为的文件(~/.docker/config.json从生成的默认值)

{
        "auths": {
                "docker.io": {
                        "auth": "XXXXXXXXXXXXX",
                        "email": "x.y@gmail.com"
                }
        }
}

到-注意从docker.io-> index.docker.io/v1所做的更改。那是变化。

{
        "auths": {
                "https://index.docker.io/v1/": {
                        "auth": "XXXXXXXXXXXXX",
                        "email": "x.y@gmail.com"
                }
        }
}

希望能有所帮助。

请注意,auth字段应使用’username:password’base64编码。例如:“ username:password” base64编码为“
dXNlcm5hbWU6cGFzc3dvcmQ =”

因此您的文件将包含:

"auth": "dXNlcm5hbWU6cGFzc3dvcmQ="


 类似资料:
  • 在从主机推送docker映像(成功登录后)时,我得到了“未经授权:需要身份验证”。 详情如下。 Docker版本:1.9.1(客户端和服务器) /var/log/messages显示403,我不知道这个docker。见下文。 非常感谢您的帮助,如果您需要更多信息,请告诉我。我也用-f推了推。不走运!

  • 我遵循了GitHub教程中的所有内容:https://help.github.com/articles/generating-ssh-keys 我在存储库的目录中执行了所有命令。我成功到达教程的末尾,并收到消息:“嗨,用户名!你已成功通过身份验证,但 GitHub 不提供外壳访问。 然而,当我尝试做推送之类的事情时,它仍然要求输入我的用户名和密码。

  • 我有一个JavaJSF 2,Spring 3,HiberNate 4JavaEE应用程序,它使用第三方库来验证用户。我将所需的CA证书导入到我的JVM中,将第三个库添加到项目中,并在web.xml.中配置该库从智能卡读取用户详细信息。整个设置正在工作,第三方库将用户带到主页。 以下是我的要求,以确保应用程序。 再次检查该用户是否存在于特定于应用程序的数据库中 我看了这个链接,似乎“身份验证处理过滤

  • 我正在尝试使用基本身份验证获取url。我设置用户/密码如下所示。同样的凭证在邮递员中工作。 我认为凭据设置不正确。这里怎么了?错误:

  • 问题内容: 我想在我的Django编码网站中添加一些Ajax -niceness。 在我的Django代码中,我使用装饰器标记哪个视图需要认证。未经身份验证的用户单击时的默认行为是将其重定向到登录页面,然后传递目标页面。 我在某些网站上看到的,并且真正喜欢的是,当用户单击一个指向仅限于登录用户的位置的链接时,他/她得到了一个弹出窗口(通过JavaScript),而不是重定向到登录页面,而是询问他/

  • 我试图在我的API中向一个endpoint发出请求,然而,每次试图访问执行器endpoint都会返回401错误,访问这个资源需要完全身份验证。我只是使用spring security对用户的密码进行加密,然后再将它们存储到数据库中。我已经检查了所有类似的问题,并执行了他们给出的所有解决方案,但仍然没有运气。 securityconfig.java userService.java