为什么我不能将本地 Docker 图像推送到 Docker Hub 存储库?

Why can't I push local Docker image to Docker Hub repo?

我有 Docker ID,比方说 -> KN,并创建了一个私人仓库。我也可以通过 CLI 登录 Docker Hub。我 运行 基于图像的容器并使用以下命令将该容器提交到图像

docker commit ub18 reponame/ub18 ==> successfull

但是当我像下面那样推送那个图片时,它没有上传。

Docker 张图像的输出在顶部显示此图像。

docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
standard/ub18       latest              c8ebc0f1dd75        12 seconds ago      102MB


docker push reponame/ub18  ==> gives error
The push refers to repository [docker.io/standard/ub18]
7660ded5319c: Preparing 
94e5c4ea5da6: Preparing 
5d74a98c48bc: Preparing 
604cbde1a4c8: Preparing 
denied: requested access to the resource is denied

因此,要将您的图像推送到您的 Docker Hub 仓库,您必须首先使用用户名和密码登录 Docker Hub 仓库:

docker login

然后正确地对图像进行标记:

docker tag image_id yourhubusername/reponame:tag

您的图片标签必须采用这种特定格式。 然后推送:

docker push yourhubusername/reponame:tag

假设您已登录。

如果您想了解更多信息,请参阅docker docs