docker阿里创库镜像地址 阿里云docker 容器镜像 仓库_docker

一:阿里云相关配置

1.进入容器镜像服务ACR控制台

① 进入阿里云官网:https://www.aliyun.com/

点击:产品 - 容器与中间件 - 镜像服务ACR

docker阿里创库镜像地址 阿里云docker 容器镜像 仓库_docker阿里创库镜像地址_02

② 点击:管理控制台

docker阿里创库镜像地址 阿里云docker 容器镜像 仓库_docker_03

2.开通容器镜像服务

① 点击:前往开通

docker阿里创库镜像地址 阿里云docker 容器镜像 仓库_docker阿里创库镜像地址_04

② 点击:设置Registry登录密码

docker阿里创库镜像地址 阿里云docker 容器镜像 仓库_bc_05

③ 设置密码 - 确定

docker阿里创库镜像地址 阿里云docker 容器镜像 仓库_docker阿里创库镜像地址_06

3.创建镜像仓库

① 点击:创建镜像仓库

docker阿里创库镜像地址 阿里云docker 容器镜像 仓库_bc_07

② 填写相关信息

  • 地域:镜像仓库的物理存放地址(选择里自己比较近的区域即可)
  • 命名空间:仓库的命名空间
  • 仓库名称:镜像仓库的名称
  • 仓库类型:公开(可以被任何人使用)、私有(只能自己使用,需要账号密码验证)
  • 摘要:镜像仓库的摘要
  • 描述信息:镜像仓库的描述信息

docker阿里创库镜像地址 阿里云docker 容器镜像 仓库_docker_08

③ 选择:本地仓库 - 创建镜像仓库

docker阿里创库镜像地址 阿里云docker 容器镜像 仓库_docker阿里创库镜像地址_09

④ 添加成功

docker阿里创库镜像地址 阿里云docker 容器镜像 仓库_docker_10

二:操作指南

1.登录阿里云Docker Registry

docker login --username=用户名 [仓库URL]
  • 用户名:阿里云账号全名
  • 密码:开通服务时设置的密码

2.从Registry中拉取镜像

docker pull [仓库URL]/[命名空间]/[仓库名称]:[镜像版本号]

3.将镜像推送到Registry

# 1.登录阿里云Docker Registry
docker login --username=用户名 [仓库URL] 

# 2.为镜像添加标签
docker tag [镜像ID] [仓库URL]/[命名空间]/[仓库名称]:[镜像版本号]
# 实例
[root@localhost ~]# docker tag 74d107221092 registry.cn-hangzhou.aliyuncs.com/darker-x/common_software:redis_v1

# 3.将本地镜像推送到Registry
docker push [仓库URL]/[命名空间]/[仓库名称]:[镜像版本号]

# 实例
[root@localhost ~]# docker push registry.cn-hangzhou.aliyuncs.com/darker-x/common_software:redis_v1
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/darker-x/common_software]
d3fc9f08141a: Pushed
06d5c35d63a8: Pushed
4bc5e04ae889: Pushed
60f4b166131f: Pushed
c492b4fe510f: Pushed
f5600c6330da: Pushed
redis_v1: digest: sha256:c23e8246c42ac8cb59452eb112b75ef92bb8ce924204fbc2899f76ee88f38323 size: 1572

4.实例

# 登录
[root@localhost ~]# docker login --username=xxq 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


# 为镜像添加标签
[root@localhost ~]# docker tag 74d107221092 registry.cn-hangzhou.aliyuncs.com/darker-x/common_software:redis_v1


# 将本地镜像推送到Registry
[root@localhost ~]# docker push registry.cn-hangzhou.aliyuncs.com/darker-x/common_software:redis_v1
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/darker-x/common_software]
d3fc9f08141a: Pushed
06d5c35d63a8: Pushed
4bc5e04ae889: Pushed
60f4b166131f: Pushed
c492b4fe510f: Pushed
f5600c6330da: Pushed
redis_v1: digest: sha256:c23e8246c42ac8cb59452eb112b75ef92bb8ce924204fbc2899f76ee88f38323 size: 1572


# 删除本地的redis
[root@localhost ~]# docker rmi 74d107221092 -f
Untagged: redis:latest
Untagged: redis@sha256:5b98e32b58cdbf9f6b6f77072c4915d5ebec43912114031f37fa5fa25b032489
Untagged: registry.cn-hangzhou.aliyuncs.com/darker-x/common_software:redis_v1
Untagged: registry.cn-hangzhou.aliyuncs.com/darker-x/common_software@sha256:c23e8246c42ac8cb59452eb112b75ef92bb8ce924204fbc2899f76ee88f38323
Deleted: sha256:74d107221092875724ddb06821416295773bee553bbaf8d888ababe9be7b947f
Deleted: sha256:d951b383737320b4e1ac7f9bb63f3919bcf25363ccb59fbb52a41e45ba70ffdd
Deleted: sha256:d3b2581a1c92973ee9a41fc00e5628047ce7e644a66240fb859b38831bd525b4
Deleted: sha256:a447231da503a58432b4d7409980139206fdf398fbde189d8a7229dd0663f472
Deleted: sha256:f786204ca260bcaef3d47ecad10821878028239072c65ceb2a1f212f275f9367
Deleted: sha256:b68afce5f52461f79be59806be00e43ea95152a0358b8dc5de9ac3f486a70d7e
Deleted: sha256:f5600c6330da7bb112776ba067a32a9c20842d6ecc8ee3289f1a713b644092f8


# 从Registry中拉取镜像
[root@localhost ~]# docker pull registry.cn-hangzhou.aliyuncs.com/darker-x/common_software:redis_v1
redis_v1: Pulling from darker-x/common_software
852e50cd189d: Pull complete
76190fa64fb8: Pull complete
9cbb1b61e01b: Pull complete
d048021f2aae: Pull complete
6f4b2af24926: Pull complete
1cf1d6922fba: Pull complete
Digest: sha256:c23e8246c42ac8cb59452eb112b75ef92bb8ce924204fbc2899f76ee88f38323
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/darker-x/common_software:redis_v1
registry.cn-hangzhou.aliyuncs.com/darker-x/common_software:redis_v1