Docker-Core (5) - Push the image to Alibaba Cloud

1. Mirror push

  1. The docker push command can push your own image to the Alibaba Cloud warehouse, you need to register in advance
  2. Create a new Alibaba Cloud mirror warehouse: https://cr.console.aliyun.com/cn-hangzhou/repositories
    • The name of the warehouse should be named after the specific service name, such as redis, mysql, etc.

image.png

  • type local warehouse

image.png

  • After the creation is successful, there will be a prompt to use

image.png

1. 登录阿里云Docker Registry
$ docker login --username=xxx registry.cn-hangzhou.aliyuncs.com
用于登录的用户名为阿里云账号全名,密码为开通服务时设置的密码。

您可以在访问凭证页面修改凭证密码。

2. 从Registry中拉取镜像
$ docker pull registry.cn-hangzhou.aliyuncs.com/tianxincode/tianxincoord:[镜像版本号]
3. 将镜像推送到Registry
$ docker login --username=xxx registry.cn-hangzhou.aliyuncs.com
$ docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/tianxincode/tianxincoord:[镜像版本号]
$ docker push registry.cn-hangzhou.aliyuncs.com/tianxincode/tianxincoord:[镜像版本号]
请根据实际镜像信息替换示例中的[ImageId]和[镜像版本号]参数。

4. 选择合适的镜像仓库地址
从ECS推送镜像时,可以选择使用镜像仓库内网地址。推送速度将得到提升并且将不会损耗您的公网流量。

如果您使用的机器位于VPC网络,请使用 registry-vpc.cn-hangzhou.aliyuncs.com 作为Registry的域名登录。

5. 示例
使用"docker tag"命令重命名镜像,并将它通过专有网络地址推送至Registry。

$ docker images
REPOSITORY                                                         TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
registry.aliyuncs.com/acs/agent                                    0.7-dfb6816         37bb9c63c8b2        7 days ago          37.89 MB
$ docker tag 37bb9c63c8b2 registry-vpc.cn-hangzhou.aliyuncs.com/acs/agent:0.7-dfb6816
使用 "docker push" 命令将该镜像推送至远程。

$ docker push registry-vpc.cn-hangzhou.aliyuncs.com/acs/agent:0.7-dfb6816
  1. Log in to Alibaba Cloud Docker Registry, the user name used to log in is the full name of the Alibaba Cloud account, and the password is the password set when opening the service
docker login --username=xxx registry.cn-hangzhou.aliyuncs.com
  • Password verification required for first login
[root@localhost redis]# docker login --username=xxx registry.cn-hangzhou.aliyuncs.com
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
  1. Label the image with information
docker tag aa4d65e670d6 registry.cn-hangzhou.aliyuncs.com/tianxincode/tianxincoord:6.2
  1. Push the image to Registry
docker push registry.cn-hangzhou.aliyuncs.com/tianxincode/tianxincoord:6.2

image.png

2. Mirror image pull

docker pull registry.cn-hangzhou.aliyuncs.com/tianxincode/tianxincoord:6.2

Guess you like

Origin blog.csdn.net/sinat_34104446/article/details/125033605