如何在Arch Linux/Manjaro上安装Podman

时间:2020-02-23 14:31:36  来源:igfitidea点击:

在本教程中,我们将学习如何在Arch Linux/Manjaro上安装Podman。 Podman是用于创建和维护Linux容器的命令行工具。它是libpod库的一部分。 Podman是一个无守护程序的容器引擎,用于在Linux系统上开发,管理和运行OCIContainer。 Docker和Podman之间的主要区别是Podman中没有守护程序。

在Arch Linux/Manjaro上安装Podman

更新Arch/Manjaro系统。

sudo pacman -Syyu

更新所有软件包后,继续在Arch Linux/Manjaro上安装Podman。

sudo pacman -S podman

我们应该获得类似于以下的输出。

....................................................................................
resolving dependencies...
looking for conflicting packages...

Packages (6) cni-plugins-0.8.1-1  conmon-1:0.3.0-1  ostree-2019.2-1  skopeo-0.1.37-1  slirp4netns-0.3.0-1  podman-1.4.2-1

Total Download Size:    31.90 MiB
Total Installed Size:  186.47 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 cni-plugins-0.8.1-1-x86_64                                       8.8 MiB   179K/s 00:50 [###################################################] 100%
 conmon-1:0.3.0-1-x86_64                                         21.0 KiB  1615K/s 00:00 [###################################################] 100%
 skopeo-0.1.37-1-x86_64                                           4.6 MiB   496K/s 00:09 [###################################################] 100%
 slirp4netns-0.3.0-1-x86_64                                      62.3 KiB  15.2M/s 00:00 [###################################################] 100%
 podman-1.4.2-1-x86_64     18.4 MiB   464K/s 00:41 [###############] 100%(6/6) checking keys in keyring                     [###############] 100%(6/6) checking package integrity                   [###############] 100%
(6/6) loading package files                        [###############] 100%
(6/6) checking for file conflicts                  [###############] 100%
(6/6) checking available disk space                [###############] 100%
:: Processing package changes...
(1/6) installing cni-plugins                       [###############] 100%
(2/6) installing conmon                            [###############] 100%
(3/6) installing ostree                            [###############] 100%
(4/6) installing skopeo                            [###############] 100%
(5/6) installing slirp4netns                       [###############] 100%
(6/6) installing podman                            [###############] 100%
Optional dependencies for podman
    podman-docker: for Docker-compatible CLI
:: Running post-transaction hooks...
(1/4) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 5.1.3-arch1-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 5.1.3-arch1-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: aic94xx
  -> Running build hook: [filesystems]
  -> Running build hook: [keyboard]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful
(2/4) Reloading system manager configuration...
(3/4) Creating temporary files...
(4/4) Arming ConditionNeedsUpdate...

确认已安装Podman的版本。

$podman --version
podman version 1.4.2

$pacman -Qi podman
 Name            : podman
 Version         : 1.4.2-1
 Description     : Tool and library for running OCI-based containers in pods
 Architecture    : x86_64
 URL             : https://github.com/containers/libpod
 Licenses        : Apache
 Groups          : None
 Provides        : None
 Depends On      : cni-plugins  conmon  device-mapper  iptables  libseccomp  ostree  runc  skopeo  btrfs-progs  slirp4netns
 Optional Deps   : podman-docker: for Docker-compatible CLI
 Required By     : None
 Optional For    : None
 Conflicts With  : None
 Replaces        : None
 Installed Size  : 96.95 MiB
 Packager        : Bartłomiej Piotrowski theitroad@localhost
 Build Date      : Sun 23 Jun 2019 10:40:38 AM EAT
 Install Date    : Tue 25 Jun 2019 11:54:16 PM EAT
 Install Reason  : Explicitly installed
 Install Script  : No
 Validated By    : Signature

有关详细的输出,请运行:

$sudo podman info
host:
  BuildahVersion: 1.9.0
  Conmon:
    package: Unknown
    path: /usr/bin/conmon
    version: 'conmon version 0.3.0, commit: 8455ce1ef385120deb827d0f0588c04357bad4c4'
  Distribution:
    distribution: arch
    version: unknown
  MemFree: 665116672
  MemTotal: 16717189120
  OCIRuntime:
    package: Unknown
    path: /usr/bin/runc
    version: |
      runc version 1.0.0-rc8
      commit: 425e105d5a03fabd737a126ad93d62a9eeede87f
      spec: 1.0.1-dev
  SwapFree: 8479567872
  SwapTotal: 8489267200
  arch: amd64
  cpus: 8
  hostname: techwiz.localhost
  kernel: 5.1.3-arch1-1-ARCH
  os: linux
  rootless: false
  uptime: 14h 44m 47.28s (Approximately 0.58 days)
registries:
  blocked: null
  insecure: null
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 0
  GraphDriverName: overlay
  GraphOptions:
  - overlay.mountopt=nodev
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  ImageStore:
    number: 0
  RunRoot: /var/run/containers/storage
  VolumePath: /var/lib/containers/storage/volumes

在Arch Linux/Manjaro上测试Podman安装

让我们确认podman正在我们的Arch Linux/Manjaro系统上工作。

拉Alpine Linux docker镜像。

$podman pull alpine
Trying to pull docker.io/library/alpine...Getting image source signatures
Copying blob 921b31ab772b done
Copying config 4d90542f06 done
Writing manifest to image destination
Storing signatures
4d90542f0623c71f1f9c11be3da23167174ac9d93731cf91912922e916bab02c

列出下载的图像:

$podman images
REPOSITORY                 TAG      IMAGE ID       CREATED      SIZE
docker.io/library/alpine   latest   4d90542f0623   6 days ago   5.85 MB

运行Alpine Linux镜像容器来测试我们的安装。

$podman run --name test --rm docker.io/library/alpine "cat" etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.10.0
PRETTY_NAME="Alpine Linux v3.10"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"