我构建了一个Docker镜像,我将其推送到我帐户下的Docker Hub,然后在本地删除。但是当我尝试拉它时,会抛出以下错误:
Error response from daemon: pull access denied for mightyspaj/dockerfile-assignment-1, repository does not exist or may require 'docker login'
我已登录拥有此图片的存储库的同一帐户,并且可以完全执行其他任务(例如推送)。存储库也肯定存在于Docker Hub上,但当我尝试拉它时它就失败了。
config.json
并重新生成Docker
运行隔离的docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock:ro docker sh
容器,然后登录我的帐户并尝试提取图片所有这些事情仍会产生同样的错误。我感到困惑。
要注意,我的客户端和引擎版本都是17.12.0-ce
。我的操作系统是Ubuntu 17.10(64位)。
docker login
-> % 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: mightyspaj
Password:
Login Succeeded
docker tag
-> % docker tag dockerfile-assignment-1:latest mightyspaj/dockerfile-assignment-1
docker push
-> % docker push mightyspaj/dockerfile-assignment-1
The push refers to repository [docker.io/mightyspaj/dockerfile-assignment-1]
8427a8e6a29f: Pushed
655a921743e8: Pushed
8aa44edb7524: Pushed
60f1a2dc4cd8: Mounted from library/node
9185fe936b87: Mounted from library/node
e53f74215d12: Mounted from library/node
latest: digest: sha256:6c68220ba84f13d0229ef4458f22369410bb98764b908a75be0849c3003de160 size: 1582
docker image rm
-> % docker image rm mightyspaj/dockerfile-assignment-1
Untagged: mightyspaj/dockerfile-assignment-1:latest
Untagged: mightyspaj/dockerfile-assignment-1@sha256:6c68220ba84f13d0229ef4458f22369410bb98764b908a75be0849c3003de160
docker image pull
-> % docker image pull mightyspaj/dockerfile-assignment-1
Using default tag: latest
Error response from daemon: pull access denied for mightyspaj/dockerfile-assignment-1, repository does not exist or may require 'docker login'
答案 0 :(得分:0)
只有将存储库公开后,我才能解决同一问题。确保存储库是公共的,然后这是我在命令行中遵循的说明集: 从docker hub注销后,再次登录。
1- docker logout
2- docker login --username=YOURUSERNAME
询问时输入密码
3- docker pull repositoryName"/"imageName[:tag]
如果不包括“标签”,则默认值为“最新”。
然后通过docker images
命令检查图像以检查其是否被拉出。
拉完后,我再次将存储库设为私有。
答案 1 :(得分:-1)
此解决方案仅在私有Docker存储库上有效!
首先尝试登录您的私人仓库,例如:
docker login dockerrepo.example.com
然后 如果您使用dockerfile 基于私有存储库中的映像构建新映像,则必须在基本映像前添加私有存储库URL:
从动 PRIVATE_REPO_URL + IMAGE_INFO
示例:
PRIVATE_REPO_URL --> dockerrepo.example.com
BASE_IMAGE --> samples/java/jdk:1.6
您的dockerfile看起来像这样:
FROM dockerrepo.example.com/samples/java/jdk:1.6