podman案例:打包本地镜像,发送给别人或者上传镜像
1.使用场景
- 当别人的Linux系统没有网络,但是又需要镜像来创建容器时,可以将自己下载好的镜像打包发送给别人使用
- 要自建镜像仓库,就需要一些镜像的包,可以将本地的镜像打包好,上传到镜像仓库
2.打包流程
[root@rhel-liuyunfei-82 ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.redhat.io/rhel8/httpd-24 latest 0d04740850e8 8 days ago 462 MB
registry.redhat.io/rhel8/httpd-24 1-160 0d04740850e8 8 days ago 462 MB
registry.redhat.io/rhel8/mariadb-105 1-25 788859b7aa2d 8 days ago 594 MB
registry.access.redhat.com/ubi7/ubi latest 6f683d6ef7a8 4 weeks ago 216 MB
[root@rhel-liuyunfei-82 ~]
[root@rhel-liuyunfei-82 ~]
-rw-r--r--. 1 root root 461558272 Nov 4 17:39 httpd-24.tar
2.1可以有多种打包的书写方式
- podman save --quiet -o myimage.tar imageID
- podman save --format docker-dir -o ubuntu-dir ubuntu
- podman save > alpine-all.tar alpine:latest
3.发送给需要的人或者上传到镜像仓库
3.1发送给需要的人
[root@rhel-liuyunfei-82 ~]
liuyunfei@192.168.159.137's password:
httpd-24.tar 100% 440MB 209.1MB/s 00:02
[liuyunfei@rhel-liuyunfei-82 ~]$ ll -h ~
total 441M
-rw-r--r--. 1 liuyunfei liuyunfei 441M Nov 4 17:47 httpd-24.tar
3.2上传到镜像仓库
[liuyunfei@rhel-liuyunfei-8-3 ~]$ podman login docker.io
Username:
Password:
Login Succeeded!
[liuyunfei@rhel-liuyunfei-8-3 ~]$ podman push docker.io/image:v1
4.他人在接收到发送过来的镜像包后进行导入。
[liuyunfei@rhel-liuyunfei-82 ~]$ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
[liuyunfei@rhel-liuyunfei-82 ~]$ ll -h ~
total 441M
-rw-r--r--. 1 liuyunfei liuyunfei 441M Nov 4 17:47 httpd-24.tar
[liuyunfei@rhel-liuyunfei-82 ~]$ podman load -i httpd-24.tar
Getting image source signatures
Copying blob 1aa5ea576231 done
Copying blob 5bc03dec6239 done
Copying blob 525ed45dbdb1 done
Copying blob 8f2a8d697256 done
Copying config 0d04740850 done
Writing manifest to image destination
Storing signatures
Loaded image(s): registry.redhat.io/rhel8/httpd-24:latest
[liuyunfei@rhel-liuyunfei-82 ~]$ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.redhat.io/rhel8/httpd-24 latest 0d04740850e8 8 days ago 462 MB