![docker push 到私有注册表 - 本地不存在带有标签的图像:localhost:5000/xxxx](https://linux22.com/image/1184753/docker%20push%20%E5%88%B0%E7%A7%81%E6%9C%89%E6%B3%A8%E5%86%8C%E8%A1%A8%20-%20%E6%9C%AC%E5%9C%B0%E4%B8%8D%E5%AD%98%E5%9C%A8%E5%B8%A6%E6%9C%89%E6%A0%87%E7%AD%BE%E7%9A%84%E5%9B%BE%E5%83%8F%EF%BC%9Alocalhost%3A5000%2Fxxxx.png)
我正在运行私人注册表
sudo docker run -d -p 5000:5000 --restart always --name registry registry:2
sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1707fb042a43 registry:2 "/entrypoint.sh /etc…" 4 days ago Up 2 hours 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp registry
我有图像需要推送到我的私人注册表
sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
coinbase latest 7bfb7cc3d51c 11 months ago 781MB
当我尝试将我的图像推送到我的私人注册表时
sudo docker push localhost:5000/coinbase:latest
docker 回答我:
The push refers to repository [localhost:5000/coinbase]
An image does not exist locally with the tag: localhost:5000/coinbase
为什么?它似乎不理解 localhost:5000 是我的私有注册表的 URL。错误在哪里?
答案1
您需要使用包含的注册主机标记您的图像
docker image tag coinbase:latest localhost:5000/coinbase:latest
查看docker push 文档了解详细信息和示例。