本文介绍在Ubuntu操作系统上安装Podman(Pod Manager)的方法。它是一个用于创建和维护容器的工具,podman包位于PPA存储库中,需要在安装之前添加,适用Ubuntu 18.04等版本,可参考安装以使用Podman可以在非root权限中运行Linux容器一文。
在Ubuntu上安装Podman 在Ubuntu计算机上启动一个新的终端会话并运行下面的命令: sudo apt update sudo apt -y install software-properties-common sudo add-apt-repository -y ppa:projectatomic/ppa 添加存储库后,继续安装Podman: sudo apt -y install podman 安装后,你可以显示有关主机、当前存储统计信息和podman构建的信息: # podman info host: BuildahVersion: 1.7-dev Conmon: package: 'cri-o-1.12: /usr/lib/crio/bin/conmon' path: /usr/lib/crio/bin/conmon version: 'conmon version 1.12.4-dev, commit: ' Distribution: distribution: ubuntu version: "18.04" MemFree: 720404480 MemTotal: 1033080832 OCIRuntime: package: 'cri-o-runc: /usr/sbin/runc' path: /usr/sbin/runc version: 'runc version spec: 1.0.1-dev' SwapFree: 2047864832 SwapTotal: 2047864832 arch: amd64 cpus: 2 hostname: ubuntu-01 kernel: 4.15.0-42-generic os: linux rootless: false uptime: 2m 5.03s insecure registries: registries: [] registries: registries: - docker.io - registry.fedoraproject.org - quay.io - registry.access.redhat.com - registry.centos.org store: ConfigFile: /etc/containers/storage.conf ContainerStore: number: 1 GraphDriverName: overlay GraphOptions: null GraphRoot: /var/lib/containers/storage GraphStatus: Backing Filesystem: extfs Native Overlay Diff: "true" Supports d_type: "true" Using metacopy: "false" ImageStore: number: 2 RunRoot: /var/run/containers/storage 注:以上操作在Ubuntu 18.04版本中测试成功。
在Ubuntu上测试使用Podman Pull Alpine docker image: $ podman pull alpine Trying to pull docker.io/library/alpine…Getting image source signatures Copying blob 8e402f1a9c57: 2.63 MiB / 2.63 MiB [=======================] 5s Copying config 5cb3aa00f899: 1.48 KiB / 1.48 KiB [=====================] 0s Writing manifest to image destination Storing signatures 5cb3aa00f89934411ffba5c063a9bc98ace875 列出已下载的images,运行podman images命令:
Podman的本地存储库位于/var/lib/containers中。 使用命令运行容器,命令选项类似于docker: $ podman run -it --rm docker.io/library/alpine /bin/sh / # apk update fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz v3.9.2-1-g592d872fb8 [http://dl-cdn.alpinelinux.org/alpine/v3.9/main] v3.9.2-2-ge7dc3349a9 [http://dl-cdn.alpinelinux.org/alpine/v3.9/community] OK: 9754 distinct packages available / # apk add vim (1/5) Installing lua5.3-libs (5.3.5-r1) (2/5) Installing ncurses-terminfo-base (6.1_p20190105-r0) (3/5) Installing ncurses-terminfo (6.1_p20190105-r0) (4/5) Installing ncurses-libs (6.1_p20190105-r0) (5/5) Installing vim (8.1.0630-r0) Executing busybox-1.29.3-r10.trigger OK: 40 MiB in 19 packages / # exit 显示正在运行的容器,运行podman ls命令:
测试运行相当的好,Podman安装很成功。
相关主题 |