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

denied: requested access to the resource is denied

注:我已成功登录docker


当前回答

修改图像名称为"username"/"image_name"

其他回答

有一个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 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

这可能是特定于DigitalOceans容器注册表,但它可能有帮助:

在我的例子中,我的管道在docker推送之后触发了一个清理作业(doctl注册表垃圾收集启动),这将注册表置于只读模式(参见doc)。因此,在清理作业处于活动状态时的下一个推送将被拒绝:对资源的请求访问将被拒绝。

如果doctl注册表垃圾收集get-active返回404,则作业完成,docker推送将成功完成。

OS: Ubuntu16.04

原因:我删除了客户端配置文件(~/.docker/config.json)

解决方案:

重启码头工人。 服务docker重启。 它需要输入登录信息,然后自动生成配置文件。 Docker login——username=yourdockerhubername——email=youremail@company.com

不允许误导标签名称。 我的解决方法是:

Command 1(Create Tag): docker tag my-nginx:latest rsachde/nginx-repository/trys:1.0 (Didn't push)
Command 2(Push): docker push rsachde/nginx-repository/try:1.0 

输出:

Denied:拒绝访问资源的请求


Command 1.1(Create Tag): docker tag my-nginx:latest rsachde/nginx-repository/:trys 
Command 2.2(Push): docker push rsachde/nginx-repository:trys 

输出:

trys: digest: sha256:405b6f0ae25772ef71b8f59fd6a56ff9b426f50bd24bac2b5db41f65efd3387c 尺寸:1365

误导是标签,确保你们理解。