为什么不能将新创建的图像推送到 docker-hub?
Why can't push the new created image into docker-hub?
我想创建自己的图像并将其推送到我的 docker-hub。
准备:
mkdir /tmp/mydebian
cd /tmp/mydebian
vim mydebian.Dockerfile
#all contents omitted here
使用 Dockerfile 构建镜像:
docker build -f mydebian.Dockerfile --tag=mydebian:0.0.1 .
检查一下:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mydebian 0.0.1 bd66705654b1 5 minutes ago 460MB
登录docker:
docker login -u "myusername" -p "xxxxxxxx" docker.io
立即推送:
docker push myusername/mydebian:0.0.1
The push refers to repository [docker.io/myusername/mydebian]
An image does not exist locally with the tag: myusername/mydebian
尝试其他格式:
docker push mydebian:0.0.1
The push refers to repository [docker.io/library/mydebian]
690c901c038e: Preparing
1155352a0b68: Preparing
1201adb8bea9: Preparing
a13c519c6361: Preparing
denied: requested access to the resource is denied
如何解决?
在登录命令的末尾省略docker.io。像这样:
docker login -u "myusername" -p "xxxxxxxx"
您需要使用将用于推送的名称来标记您的图像。构建中:
docker build -f mydebian.Dockerfile --tag=myusername/mydebian:0.0.1 .
或者为现有图像添加附加标签:
docker tag mydebian:0.0.1 myusername/mydebian:0.0.1
我想创建自己的图像并将其推送到我的 docker-hub。
准备:
mkdir /tmp/mydebian
cd /tmp/mydebian
vim mydebian.Dockerfile
#all contents omitted here
使用 Dockerfile 构建镜像:
docker build -f mydebian.Dockerfile --tag=mydebian:0.0.1 .
检查一下:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mydebian 0.0.1 bd66705654b1 5 minutes ago 460MB
登录docker:
docker login -u "myusername" -p "xxxxxxxx" docker.io
立即推送:
docker push myusername/mydebian:0.0.1
The push refers to repository [docker.io/myusername/mydebian]
An image does not exist locally with the tag: myusername/mydebian
尝试其他格式:
docker push mydebian:0.0.1
The push refers to repository [docker.io/library/mydebian]
690c901c038e: Preparing
1155352a0b68: Preparing
1201adb8bea9: Preparing
a13c519c6361: Preparing
denied: requested access to the resource is denied
如何解决?
在登录命令的末尾省略docker.io。像这样:
docker login -u "myusername" -p "xxxxxxxx"
您需要使用将用于推送的名称来标记您的图像。构建中:
docker build -f mydebian.Dockerfile --tag=myusername/mydebian:0.0.1 .
或者为现有图像添加附加标签:
docker tag mydebian:0.0.1 myusername/mydebian:0.0.1