我正在按照这个链接创建我的第一个docker映像,它成功了,现在我试图从这个链接将这个映像推到我的docker存储库中。但是每当我试图将这个映像推入存储库时,我就会得到这种类型的错误。
denied: requested access to the resource is denied
注:我已成功登录docker
我正在按照这个链接创建我的第一个docker映像,它成功了,现在我试图从这个链接将这个映像推到我的docker存储库中。但是每当我试图将这个映像推入存储库时,我就会得到这种类型的错误。
denied: requested access to the resource is denied
注:我已成功登录docker
当前回答
尝试签出“Docker for Windows”应用程序和签出https://hub.docker.com/网站后执行“Docker登录”和“Docker推送”。 这对我很有帮助。
其他回答
是的,也许有些尴尬,但似乎根本没有关于这个问题的明确文档:我刚刚用私有存储库注册了Docker Pro。我创建了一个私有存储库,然后尝试向其推送。收到了可怕的“拒绝”消息。
推送到我的公共回购很正常,所以我知道我是正确登录的。
在尝试了之前30个答案中与Docker Hub相关的所有内容后…我终于明白了私人回购是如何运作的:它们与公共回购相同,但多了一个步骤。
当推送到存储库- Docker Hub帐户内的任何存储库时,您需要用您的用户名作为image:标记的前缀,例如:
给定以下值,
用户名= yourusername 图像名称=图像 标签=标签
1)标记(或提交)本地图像,添加一个前缀与您的用户名:
docker tag theimage:thetag yourusername/theimage:thetag
注:
如果你在一个组织中,你需要双前缀的图像-像这样:
docker tag theimage:thetag yourusername/yourorganizationname/theimage:thetag
如果你的标签是最新的,:标签部分可以省略;Docker假设:latest如果你没有输入:thetag部分
2)将前缀图像推送到Docker Hub:
docker push yourusername/theimage:thetag
OR
docker push yourusername/yourorganizationname/theimage:thetag
额外的步骤:
要么
在上述第1步之前,在Docker Hub帐户中创建一个私有存储库。
注意,存储库名称必须与您计划推送的映像相同。不要在存储库名称中包含thetag部分。例如,如果你的映像是ubuntu:14.04,你可以将你的存储库命名为ubuntu。
Or
如果你没有提前创建存储库(这不是必需的!):转到Docker Hub中的帐户;点击新推出的回购,然后它的设置选项卡-并使你的回购私有。
我曾见过其他人用两个前缀标记私人回购,例如xyz/abc/theimage:thetag,我认为第二个前缀是我创建的,用于将回购标记为私有。不,这只适用于组织。删除任何第二个前缀和设置我的回购名称只是图像修复了我的拒绝错误!
另一个注意事项:每个repo持有所有带有给定repo名称的标记版本的图像。例如,ubuntu:latest和ubuntu:14.04都将在ubuntu repo中。
有趣的Docker!
您可能需要在docker push之前将docker repo切换为private。
感谢Dean Wu提供的答案和ses的评论,在推送之前,请记得注销,然后从命令行登录到您的docker hub帐户
# you may need log out first `docker logout` ref. https://stackoverflow.com/a/53835882/248616
docker login
根据文件:
You need to include the namespace for Docker Hub to associate it with your account.
The namespace is the same as your Docker Hub account name.
You need to rename the image to YOUR_DOCKERHUB_NAME/docker-whale.
所以,这意味着你必须在推送之前标记你的图像:
docker tag firstimage YOUR_DOCKERHUB_NAME/firstimage
然后你就可以推它了。
docker push YOUR_DOCKERHUB_NAME/firstimage
docker处理用户id和存储库的方式可能有点令人困惑。 假设您在docker hub上创建了一个用户帐户xyz。新帐户自动建立名称空间xyz。 然后创建一个名为myrepo的存储库。存储库名称实际上是xyz/myrepo。
要推送一个图像,你应该做:
docker push docker.io/xyz/myrepo
如果需要,可以添加“:latest”或其他标签。
如果你得到的资源访问请求被拒绝错误消息:
访问https://hub.docker.com/并以xyz登录。 单击存储库xyz/myrepo。 点击合作者。 添加xyz作为合作者。
OS: Ubuntu16.04
原因:我删除了客户端配置文件(~/.docker/config.json)
解决方案:
重启码头工人。 服务docker重启。 它需要输入登录信息,然后自动生成配置文件。 Docker login——username=yourdockerhubername——email=youremail@company.com
有一个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