CentOS使用podman代替docker

1、podman
(1)podman没有守护进程
(2)非root账户可以使用podman
(3)兼容docker镜像
(4)用法是和docker一致,只需要将命令中的docker更改为podman即可

2、安装
yum install podman

3、配置文件路径
/etc/containers

(1)配置容器仓库:/etc/containers/registries.conf
[registries.search]
registries = ['registry.access.redhat.com', 'registry.redhat.io', 'docker.io']

(2)配置镜像存储路径:/etc/containers/storage.conf
graphroot = "/var/lib/containers/storage"

4、命令
(1)查找
podman search nginx

(2)拉取镜像
podman pull docker.io/library/nginx

(3)启动容器
podman run -itd -p 80:80 --name=nginx docker.io/library/nginx

(4)查看容器
podman ps -a

5、podman管理pod
这里pod和k8s里的pod类似

podman pod --help
Manage pods

Description:
  Pods are a group of one or more containers sharing the same network, pid and ipc namespaces.

Usage:
  podman pod [command]

Available Commands:
  create      Create a new empty pod
  exists      Check if a pod exists in local storage
  inspect     Displays a pod configuration
  kill        Send the specified signal or SIGKILL to containers in pod
  pause       Pause one or more pods
  prune       Remove all stopped pods
  ps          List pods
  restart     Restart one or more pods
  rm          Remove one or more pods
  start       Start one or more pods
  stats       Display a live stream of resource usage statistics for the containers in one or more pods
  stop        Stop one or more pods
  top         Display the running processes of containers in a pod
  unpause     Unpause one or more pods

参考资料:
https://podman.io/getting-started/
https://podman.io/getting-started/installation
https://blog.csdn.net/weixin_48447848/article/details/122725161