一、查找并管理容器镜像

1、显示容器注册表配置文件

cat /home/student/.config/containers/registries.conf 
unqualified-search-registries = ['registry.lab.example.com']
 
[[registry]]
location = "registry.lab.example.com"
insecure = true
blocked = false

2、使用podman search 查找,例子:在注册表中搜索名称以“ubi”开头的镜像

podman search registry.lab.example.com/ubi
INDEX         NAME                                DESCRIPTION   STARS   OFFICIAL   AUTOMATED
example.com   registry.lab.example.com/ubi7/ubi                 0                  
example.com   registry.lab.example.com/ubi8/ubi                 0                

3、使用podman login 命令登录容器注册表,可以使用podman --help查看帮助,--useradmin 直接带用户名。

podman login registry.lab.example.com   --username admin --password redhat321
WARNING! Using --password via the cli is insecure. Please consider using --password-stdin
Login Succeeded!

4、提取镜像:podman pull,从注册表中提取容器镜像。

podman  pull registry.lab.example.com/rhel8/httpd-24
Trying to pull registry.lab.example.com/rhel8/httpd-24...
Getting image source signatures
Copying blob 9d20433efa0c skipped: already exists  
Copying blob 77c58f19bd6e skipped: already exists  
Copying blob 47db82df7f3f skipped: already exists  
Copying config 7e93f25a94 done  
Writing manifest to image destination
Storing signatures
7e93f25a946892c9c175b74a0915c96469e3b4845a6da9f214fd3ec19c3d7070
   已上为已经安装过,再执行了,所以报已存在了。

5、查看镜像:podman image,查看本地存储镜像。下图是上面提取完的镜像。

podman  images  
REPOSITORY                                TAG      IMAGE ID       CREATED         SIZE
registry.lab.example.com/rhel8/httpd-24   latest   7e93f25a9468   22 months ago   430 MB

6、删除镜像:podman rmi移除本地存储的镜像

podman  rmi  registry.lab.example.com/rhel8/httpd-24:latest 
Untagged: registry.lab.example.com/rhel8/httpd-24:latest
Deleted: 7e93f25a946892c9c175b74a0915c96469e3b4845a6da9f214fd3ec19c3d7070


再次查看:显示为空
podman images 
REPOSITORY   TAG   IMAGE ID   CREATED   SIZE

已上为podmon增删改查的基本操作。

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐