本地镜像发布到阿里云
# 本地镜像发布到阿里云
# 流程
# 镜像的生成方法
第一种:基于当前容器创建一个新的镜像,新功能增强
第二种:DockerFile章节
# 将本地镜像推送到阿里云
# 本地镜像原型
[root@frx01 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
frx01/myubuntu 1.3 64df8ffb7faf 3 days ago 179MB
ubuntu latest ba6acccedd29 11 months ago 72.8MB
centos latest 5d0da3dc9764 12 months ago 231MB
tomcat 8.5.27 a92c139758db 4 years ago 558MB
1
2
3
4
5
6
2
3
4
5
6
- 选择控制台,进入容器镜像服务
- 进入个人实例
- 创建命名空间
- 创建镜像仓库
- 进入管理页面获得脚本
# 将镜像推送到阿里云
- 将镜像推送到阿里云registy
- 管理页面脚本
- 执行3的命令
docker login --username=冯荣旭 registry.cn-shenzhen.aliyuncs.com
docker tag [ImageId] registry.cn-shenzhen.aliyuncs.com/frx01/myubuntu1.3:[镜像版本号]
docker push registry.cn-shenzhen.aliyuncs.com/frx01/myubuntu1.3:[镜像版本号]
1
2
3
2
3
密码是自己容器镜像下面的访问凭证设置的密码
设置image id和版本号
- 在阿里云上面查看结果
# 将阿里云的镜像下载到本地
[root@frx01 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.cn-shenzhen.aliyuncs.com/frx01/myubuntu1.3 1.3 64df8ffb7faf 3 days ago 179MB
frx01/myubuntu 1.3 64df8ffb7faf 3 days ago 179MB
ubuntu latest ba6acccedd29 11 months ago 72.8MB
centos latest 5d0da3dc9764 12 months ago 231MB
tomcat 8.5.27 a92c139758db 4 years ago 558MB
[root@frx01 ~]# docker rmi -f 64df8ffb7faf
Untagged: frx01/myubuntu:1.3
Untagged: registry.cn-shenzhen.aliyuncs.com/frx01/myubuntu1.3:1.3
Untagged: registry.cn-shenzhen.aliyuncs.com/frx01/myubuntu1.3@sha256:76bc84ede8beac0565b660ce31f588d6d2a1bcbc02f34b6c5b0563023f9b537e
Deleted: sha256:64df8ffb7faf445aa2c8e0e69e67819c4abe549dae7f6ddea943b1a62588b190
Deleted: sha256:7d5069718116e4d0a0329ef44838cda33f59aefae7e97e6e403185db6d3a9a80
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
[root@frx01 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest ba6acccedd29 11 months ago 72.8MB
centos latest 5d0da3dc9764 12 months ago 231MB
tomcat 8.5.27 a92c139758db 4 years ago 558MB
[root@frx01 ~]# docker pull registry.cn-shenzhen.aliyuncs.com/frx01/myubuntu1.3:1.3
1.3: Pulling from frx01/myubuntu1.3
7b1a6ab2e44d: Already exists
bc4c9551ae8d: Pull complete
Digest: sha256:76bc84ede8beac0565b660ce31f588d6d2a1bcbc02f34b6c5b0563023f9b537e
Status: Downloaded newer image for registry.cn-shenzhen.aliyuncs.com/frx01/myubuntu1.3:1.3
[root@frx01 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.cn-shenzhen.aliyuncs.com/frx01/myubuntu1.3 1.3 64df8ffb7faf 3 days ago 179MB
ubuntu latest ba6acccedd29 11 months ago 72.8MB
centos latest 5d0da3dc9764 12 months ago 231MB
tomcat 8.5.27 a92c139758db 4 years ago 558MB
[root@frx01 ~]# docker run -it 64df8ffb7faf /bin/bash
root@a7795849ec26:/# vim a.text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
上次更新: 2024/04/18, 13:08:42