一、Podman 简介
Podman 是一个开源的容器运行时项目,可在大多数 Linux 平台上使用。Podman 提供与 Docker 非常相似的功能。正如前面提到的那样,它不需要在你的系统上运行任何守护进程,并且它也可以在没有 root 权限的情况下运行。
Podman 可以管理和运行任何符合 OCI(Open Container Initiative)规范的容器和容器镜像。Podman 提供了一个与 Docker 兼容的命令行前端来管理 Docker 镜像。
Podman 官网地址:https://podman.io/
总之,Docker大势已去,之后将是Podman大展拳脚的时期,我们现在就来说说Podman的安装和配置。
二、Podman安装和配置
1、安装(Ubuntu环境,版本:22.04.x)
#更新apt库
sudo apt update
#安装podman
sudo apt install podman-docker
2、配置podman镜像源
这一步很重要,podman安装后默认镜像源没任何配置,使用search是搜不到镜像的
Podman配置文件( global):/etc/containers/registries.conf
#备份原配置文件
sudo mv /etc/containers/registries.conf /etc/containers/registries.conf.bak
#新建一个配置文件
sudo touch /etc/containers/registries.conf
sudo vim /etc/containers/registries.conf
将以下内容写入registries.conf文件,当然也可以直接编辑registries.conf
[[registry]]
prefix = "docker.io"
location = "docker.io" #配置Docker官方镜像源
[[registry.mirror]]
location = "dev.aliyun.com" #配置阿里镜像源
insecure = true
[[registry.mirror]]
location = "registry.docker-cn.com" #配置国内docker镜像源
insecure = true
[[registry.mirror]]
location = "docker.mirrors.ustc.edu.cn" #配置清华像源
insecure = true
[[registry.mirror]]
location = "hub-mirror.c.163.com" #配置网易镜像源
insecure = true
写入后保存退出
然后启动Podman服务
#启动podman
sudo systemctl start Podman
至此,Podman安装和配置已完成,podman search已经可以搜索的镜像
我们运行看看
podman run hello-world
如何你看着以下信息,说明已经安装正常了,接下来你就可以愉快的玩耍podman了_
Resolved "hello-world" as an alias (/etc/containers/registries.conf.d/shortnames.conf)
Trying to pull docker.io/library/hello-world:latest...
Getting image source signatures
Copying blob c1ec31eb5944 done
Copying config d2c94e258d done
Writing manifest to image destination
Storing signatures
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/