我有一个标记为me/my-image的docker映像,我在dockerhub上有一个命名为me-private的私有repo。 当我推行我自己/我的形象时,我最终总是撞上公共回购。

具体将映像推到私有repo的确切语法是什么?


当前回答

首先,你需要用你的注册主机正确地标记你的图像:

docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]

然后docker push使用相同的标签。

docker push NAME[:TAG]

例子:

docker tag 518a41981a6a myRegistry.com/myImage
docker push myRegistry.com/myImage

其他回答

有两种选择:

Go into the hub, and create the repository first, and mark it as private. Then when you push to that repo, it will be private. This is the most common approach. log into your docker hub account, and go to your global settings. There is a setting that allows you to set what your default visability is for the repositories that you push. By default it is set to public, but if you change it to private, all of your repositories that you push will be marked as private by default. It is important to note that you will need to have enough private repos available on your account, or else the repo will be locked until you upgrade your plan.

在本地拉一个图像后,你可以做下面的事情:

docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

然后docker push使用相同的标签。

docker push NAME[:TAG]

例子:

docker tag gvenzl/oracle-xe:21-slim quay.io/repository/yourDirectory/oracle_xe:oracle-xe

docker push quay.io/repository/yourDirectory/oracle_xe:oracle-xe

首先,你需要用你的注册主机正确地标记你的图像:

docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]

然后docker push使用相同的标签。

docker push NAME[:TAG]

例子:

docker tag 518a41981a6a myRegistry.com/myImage
docker push myRegistry.com/myImage

如果你的docker注册表是私有和自托管的,你应该做以下事情:

docker login <REGISTRY_HOST>:<REGISTRY_PORT>
docker tag <IMAGE_ID> <REGISTRY_HOST>:<REGISTRY_PORT>/<APPNAME>:<APPVERSION>
docker push <REGISTRY_HOST>:<REGISTRY_PORT>/<APPNAME>:<APPVERSION>

例子:

docker login repo.company.com:3456
docker tag 19fcc4aa71ba repo.company.com:3456/myapp:0.1
docker push repo.company.com:3456/myapp:0.1

以下是将Docker Image推送到DockerHub的私有存储库的步骤

1-首先使用命令检查Docker图像

码头工人的图片

2-查看Docker Tag命令帮助

Docker标签——救命

3-现在标记一个名称,以您创建的图像

DockerHubUser\Private-repoName:tagName(标签名可选。默认名称为最新)

4-在推送镜像到DockerHub Private Repo之前,请先使用命令登录DockerHub

docker login[提供dockerHub用户名和密码登录]

5-现在推Docker映像到您的私人回购使用命令

docker push [options] ImgName[:tag]例如docker push DockerHubUser\Private-repoName:tagName

6-现在导航到DockerHub Private Repo,你会看到Docker映像被推送到你的私有存储库上,在前面的步骤中名称写为TagName