Podman 是一个用于虚拟化应用程序的容器工具。它最初由Red Hat开发,起源于Cri-O项目,该项目开发了一个替代Docker运行时环境的轻量级容器运行时环境。Podman 通过允许您在根和无根模式下运行容器来区别于竞争对手。此外,Podman 不是一个正在运行的服务,这意味着它是守护进程。
在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 Podman
第 1 步。首先,通过在终端中运行以下命令,确保所有系统软件包都是最新的。apt
sudo apt update
sudo apt upgrade
第 2 步。在 Ubuntu 22.04 上安装 Podman。
默认情况下,Podman 在 Ubuntu 22.04 基本存储库上可用。现在运行以下命令,将最新版本的 Podman 安装到 Ubuntu 系统中:
sudo apt install podman
现在使用以下命令检查已安装的 Podman 的版本:
podman -v
您还可以使用以下命令查看有关 Podman 的详细信息:
podman info
第 3 步。配置 Podman 注册表。
默认情况下,Podman 注册表未配置为从 Web 下载和安装容器映像,因此我们需要手动执行此操作,以便我们可以使用流行的存储库,例如 Docker.io 和 Fedora:
nano /etc/containers/registries.conf
添加以下行:
[registries.search] registries=["registry.access.redhat.com", "registry.fedoraproject.org", "docker.io"]
第 3 步。如何使用 Podman。
就像 Docker 一样,我们可以使用 Podman 命令行搜索图像,但来自上一步中添加的不同存储库。您可以在指定为的注册表中搜索 Podman 映像:
podman search debian
接下来,使用以下命令从互联网上下载最新的 Debian 镜像:
podman pull debian
如果您下载了多个映像,现在想查看系统上有哪些可用映像,我们可以使用给定的命令列出所有映像:
podman images
此外,还可以使用以下命令查看正在运行的容器:
sudo podman ps -a
您可以使用以下命令列出所有 Podman 命令选项:
podman --help
输出:
Manage pods, containers and images Usage: podman [options] [command] Available Commands: attach Attach to a running container auto-update Auto update containers according to their auto-update policy build Build an image using instructions from Containerfiles commit Create new image based on the changed container container Manage containers cp Copy files/folders between a container and the local filesystem create Create but do not start a container diff Display the changes to the object's file system events Show podman events exec Run a process in a running container export Export container's filesystem contents as a tar archive generate Generate structured data based on containers, pods or volumes healthcheck Manage health checks on containers help Help about any command history Show history of a specified image image Manage images images List images in local storage import Import a tarball to create a filesystem image info Display podman system information init Initialize one or more containers inspect Display the configuration of object denoted by ID kill Kill one or more running containers with a specific signal load Load image(s) from a tar archive login Login to a container registry logout Logout of a container registry logs Fetch the logs of one or more containers machine Manage a virtual machine manifest Manipulate manifest lists and image indexes mount Mount a working container's root filesystem network Manage networks pause Pause all the processes in one or more containers play Play containers, pods or volumes from a structured file pod Manage pods port List port mappings or a specific mapping for the container ps List containers pull Pull an image from a registry push Push an image to a specified destination rename Rename an existing container restart Restart one or more containers rm Remove one or more containers rmi Removes one or more images from local storage run Run a command in a new container save Save image(s) to an archive search Search registry for image secret Manage secrets start Start one or more containers stats Display a live stream of container resource usage statistics stop Stop one or more containers system Manage podman tag Add an additional name to a local image top Display the running processes of a container unmount Unmounts working container's root filesystem unpause Unpause the processes in one or more containers unshare Run a command in a modified user namespace untag Remove a name from a local image version Display the Podman version information volume Manage volumes wait Block on one or more containers
感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 Podman。如需其他帮助或有用信息,我们建议您查看 Podman 网站。