docker-本地镜像发布到阿里云

本地镜像发布到阿里云

镜像的生成方法

有两种方法:

  • 方法一:

上一讲已经介绍过

基于当前容器创建一个新的镜像,新功能增强

docker commit [OPTIONS] 容器ID [REPOSITORY[:TAG]]

OPTIONS说明:

-a : 提交的镜像作者;

-m :提交时的说明文字;

  • 方法二:

DockerFile

将本地镜像推送到阿里云

本质:将阿里云当作你的docker镜像仓库

步骤:

  1. 登陆阿里云开发者平台

https://cr.console.aliyun.com/

  1. 创建个人实例

  2. 创建镜像仓库 - 本地仓库

  3. 进入管理界面获得脚本

1
2
$ docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/xxxxxx:[镜像版本号]
$ docker push registry.cn-hangzhou.aliyuncs.com/xxxx:[镜像版本号]
  1. 将镜像推送到阿里云

将阿里云上的镜像下载到本地

docker pull ….

再次使用docker images命令查看:

可以发现阿里云上的镜像已经下载到了本地。

1
docker login --username=7943****@qq.com registry.cn-hangzhou.aliyuncs.com