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

denied: requested access to the resource is denied

注:我已成功登录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

其他回答

OS: Ubuntu16.04

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

解决方案:

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

最后对我有用的唯一一件事是在dockerhub中创建一个公共存储库,并用相同的名称标记本地映像,并在合作者{in dockerhub}中添加我的userID,最后推送它。

另一个(非常聪明的)原因是:你的计划已经没有私人回购了。

在使用Fabric8 Maven插件(在Windows 10上)和直接从命令行调用docker push时,我一直在与docker push作斗争。

最后我用同样的方法解决了这两个问题。

我的回购叫做vgrazi/playpen。在我的pom中,我将docker镜像名称更改为vgrazi/playpen,如下所示:

<plugin>
  <groupId>io.fabric8</groupId>
  <artifactId>docker-maven-plugin</artifactId>
  <version>0.31.0</version>
  <configuration>
     <dockerHost>npipe:////./pipe/docker_engine</dockerHost>
     <verbose>true</verbose>
     <images>
       <image>
         <name>vgrazi/playpen</name>
         <build>
           <dockerFileDir>${project.basedir}/src/main/docker/</dockerFileDir>
                         ...

这让我做一个mvn清洁包docker:build docker:push从命令行,最后,图像出现在我的repo,这是我试图解决的问题。

顺便说一句,为了回答OP并让它直接从命令行工作,没有Maven,我做了以下操作(PS是PowerShell提示符,不要键入它):

PS docker images
vgrazi/docker-test/docker-play                playpen             0722e876ebd7        40 minutes ago      536MB
rabbitmq                                      3-management        68055d63a993        10 days ago         180MB
PS docker tag 0722e876ebd7 vgrazi:playpen
PS docker push vgrazi/playpen

图像再次出现在我的docker中。Io: repo vgrazi/playpen

如果您已经登录,如果您仍然得到错误。请按照步骤操作,

PS C:\Users\rohit\Docker> docker logout
Removing login credentials for https://index.docker.io/v1/

PS C:\Users\rohit\Docker> docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: rohithpoya
Password:*****************
Login Succeeded

Logging in with your password grants your terminal complete access to your account.
For better security, log in with a limited-privilege personal access token. Learn more at https://docs.docker.com/go/access-tokens/

PS C:\Users\rohit\Docker> docker push rohithpoya/mongo-enterprise:5                                                                                                                                                                       
The push refers to repository [docker.io/rohithpoya/mongo-enterprise]                                                                                                                                                                        83ee27b8fe98: Pushed