我正在按照这个链接创建我的第一个docker映像,它成功了,现在我试图从这个链接将这个映像推到我的docker存储库中。但是每当我试图将这个映像推入存储库时,我就会得到这种类型的错误。

denied: requested access to the resource is denied

注:我已成功登录docker


当前回答

有时,当您已经使用另一个帐户登录时,可能会遇到此问题。在这些情况下,你必须:

docker logout

然后

docker login  

其他回答

有一个docker文件,要求是立即构建一个映像并将其推送到docker hub

登录Docker集线器 Sudo docker login -u your_username 输入密码 构建映像 Sudo docker build -t your_username/demorepo:1.0 上面没有提到图像名称,因为your_username/demorepo是一个 在docker中心回购。标签名称为1.0 推送图片 Sudo docker推送your_username/demorepo:1.0

将已经存在的图像推送到Docker中心

Login to the Docker hub sudo docker login -u your_username Enter password Tag your image(suppose your image is named as test_docker:1.0) sudo docker tag test_docker:1.0 your_username/demorepo:firstpush Above, firstpush is the tag name given to your image, test_docker with 1.0 Tag. IMPORTANT : (While tagging, the image name is not mentioned) Now in docker images you will have 2 images, one says test_docker 1.0 and the other your_username/demorepo firstpush Push the image sudo docker push your_username/demorepo:firstpush

从命令提示符登录Docker无法工作。当我尝试推送时,我一直得到“对资源的请求访问被拒绝”。

在登录到docker for windows应用程序本身后,docker push工作得很好。希望这能帮助到一些人。

所以,如果这对任何人有帮助的话… 我有同样的问题,这是我的问题和修复是什么。 我的测试网络上有一台名为“galaxy”的计算机。 我使用以下运行命令设置docker注册表:

sudo docker run -d 
--restart=always \
--name registry \
-v /srv/registry/certs:/certs \
-v /srv/registry/storage:/var/lib/registry \
-e REGISTRY_HTTP_ADDR=0.0.0.0:443 \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/galaxy.cert \
-e REGISTRY_HTTP_TLS_KEY=/certs/galaxy.key \
-p 443:443 \
registry:2

然后我试图从网络上的笔记本电脑推送图像到银河系,所以我这样做了:

docker login galaxy

这将给我一个错误,它会说:

Login did not succeed, error: Error response from daemon: 
    Get https://galaxy/v2/: x509: certificate signed by unknown authority

奇怪的是,解决这个问题的方法是这样登录:

docker login galaxy:443

这导致了一次成功的登录。 然后我试着把图片从我的笔记本电脑推到“银河”。 我已经为我的图像创建了一个标签,看起来像这样:

galaxy/myImage:0.0.1

所以我试着这样推它:

docker push galaxy/myImage:0.0.1

我得到的回答是:

The push refers to repository [docker.io/galaxy/myImage]
7ab460574f86: Preparing 
1aecaf56754d: Preparing 
1df1b5f06ca4: Preparing 
denied: requested access to the resource is denied

奇怪的是,我发现解决这个问题的方法是首先将图像标记如下:

docker tag myImage:0.0.1 galaxy:443/myImage:0.0.1

... 然后像这样推:

docker push galaxy:443/myImage:0.0.1

因此,出于某种原因,我不得不将端口作为存储库名称的必要部分包含在标记中。

希望这能帮助到其他人。

Docker登录参数在~/. Docker /config。Json应该正确设置(这是在登录后自动完成)

1)不传递SERVER参数登录:

$ echo "<password>" | docker login -u foo --password-stdin

成功登录后,在~/.docker/config中会出现如下结果。Json和push image成功。

***
"https://index.docker.io/v1/": {
    "auth": "YWNhcm***"
}
***

2)登录时传递SERVER参数index.docker.io

$ echo "<password>" | docker login index.docker.io -u foo --password-stdin

成功登录后,在~/.docker/config中会出现如下结果。Json和push image失败。

***
"index.docker.io": {
    "auth": "YWNhcm***"
}
***

我在git上的问题是项目权限配置。 我已经通过启用“容器注册表”在设置->通用->可见性,项目功能,权限和启用容器注册表为我的项目(链接):