Podman · 3 min read · Oct 31, 2025

CentOS 8にPodmanをインストールして使用する方法

Podmanは、コンテナを使用してアプリケーションを実行、構築、共有、展開するために使用される無料のオープンソースのLinuxネイティブツールです。コンテナとイメージ、これらのコンテナにマウントされたボリュームを管理することができます。Podmanはデーモンレスのコンテナ化エンジンであり、Dockerの代替として開発者の間で急速に人気を集めています。

この記事では、CentOS 8にPodmanコンテナ管理ソフトウェアをインストールして使用する方法を示します。

前提条件

  • CentOS 8を実行しているサーバー。
  • サーバーにルートパスワードが設定されていること。

Podmanのインストール

まず、システムにEPELリポジトリをインストールする必要があります。次のコマンドを使用してインストールできます:

dnf install epel-release -y

EPELリポジトリをインストールした後、次のコマンドを実行してPodmanをインストールします:

dnf install podman -y

Podmanがインストールされたら、次のコマンドを使用してインストールされたPodmanのバージョンを確認します:

podman --version

次の出力が表示されるはずです:

podman version 3.0.2-dev

詳細情報を取得するには、次のコマンドを実行します:

podman info

次の出力が表示されるはずです:

host:
  arch: amd64
  buildahVersion: 1.19.8
  cgroupManager: systemd
  cgroupVersion: v1
  conmon:
    package: conmon-2.0.26-3.module_el8.4.0+830+8027e1c4.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.26, commit: 9dea73702793340168deaa5a0d21ca5ce1fcb5d7'
  cpus: 2
  distribution:
    distribution: '"centos"'
    version: "8"
  eventLogger: file
  hostname: centos8
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 4.18.0-193.6.3.el8_2.x86_64
  linkmode: dynamic
  memFree: 479723520
  memTotal: 4130037760
  ociRuntime:
    name: runc
    package: runc-1.0.0-73.rc93.module_el8.4.0+830+8027e1c4.x86_64
    path: /usr/bin/runc
    version: |-
      runc version spec: 1.0.2-dev
      go: go1.15.7
      libseccomp: 2.4.1
  os: linux

Podmanでイメージを検索してダウンロードする

Debianイメージを見つけるには、次のコマンドを実行します:

podman search debian

次の出力にすべての利用可能なDebianイメージが表示されるはずです:

INDEX      NAME                                                        DESCRIPTION                                      STARS   OFFICIAL  AUTOMATED
docker.io  docker.io/library/debian                                    Debian is a Linux distribution that's compos...  3894    [OK]      
docker.io  docker.io/smartentry/debian                                 debian with smartentry                           6                 [OK]
docker.io  docker.io/library/ubuntu                                    Ubuntu is a Debian-based Linux operating sys...  12423   [OK]      
docker.io  docker.io/samueldebruyn/debian-git                          a minimal docker container with debian and g...  22                [OK]
docker.io  docker.io/i386/debian                                       Debian is a Linux distribution that's compos...  14                
docker.io  docker.io/jdub/debian-sources-resource                      Concourse CI resource to check for updated D...  0                 [OK]
docker.io  docker.io/itscaro/debian-ssh                                debian:jessie                                    28                [OK]
docker.io  docker.io/eboraas/debian                                    Debian base images, for all currently-availa...  8                 [OK]
docker.io  docker.io/amd64/debian                                      Debian is a Linux distribution that's compos...  6                 
docker.io  docker.io/arm32v7/debian                                    Debian is a Linux distribution that's compos...  72                
docker.io  docker.io/dockershelf/debian                                Repository for docker images of Debian. Test...  1                 [OK]
docker.io  docker.io/ppc64le/debian                                    Debian is a Linux distribution that's compos...  4                 
docker.io  docker.io/arm64v8/debian                                    Debian is a Linux distribution that's compos...  26                
docker.io  docker.io/spritsail/debian-builder                          A Docker image based on debian:slim ideal fo...  1                 [OK]
docker.io  docker.io/arm32v5/debian                                    Debian is a Linux distribution that's compos...  2                 
docker.io  docker.io/vpgrp/debian                                      Docker images of Debian.                         2                 
docker.io  docker.io/multiarch/debian-debootstrap                      multiarch ports of debian-debootstrap            13                
docker.io  docker.io/1and1internet/debian-9-nginx-php-7.2-wordpress-4  debian-9-nginx-php-7.2-wordpress-4               0                 [OK]
docker.io  docker.io/mdoerges/debian-buster-nginx                      Debian Buster with Nginx                         0                 
docker.io  docker.io/fleshgrinder/debian                               Debian base images for production and multis...  0                 [OK]
docker.io  docker.io/s390x/debian                                      Debian is a Linux distribution that's compos...  2                 
docker.io  docker.io/vicamo/debian                                     Debian docker images for all versions/archit...  3                 
docker.io  docker.io/konstruktoid/debian                               Debian base image                                0                 [OK]
docker.io  docker.io/casept/debian-amd64                               A debian image built from scratch. Mostly fo...  0                 
docker.io  docker.io/vergissberlin/debian-development                  Docker debian image to use for development, ...  6                 [OK]

次に、次のコマンドを使用してDebianイメージをダウンロードします:

podman pull debian

次の出力が表示されるはずです:

Resolved "debian" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/debian:latest...
Getting image source signatures
Copying blob 0bc3020d05f1 done  
Copying config 7a4951775d done  
Writing manifest to image destination
Storing signatures
7a4951775d157843b47250a2a5cc7b561d2abe0b29ae6f19737a04635302eacf

次に、次のコマンドを使用してダウンロードしたイメージを確認します:

podman images

次の出力が表示されるはずです:

REPOSITORY                TAG     IMAGE ID      CREATED       SIZE
docker.io/library/debian  latest  7a4951775d15  33 hours ago  119 MB

Podmanでコンテナを実行する

次のコマンドを使用してDebianイメージからコンテナを起動できます:

podman run -dit --name debian-container debian

次の出力が表示されるはずです:

5fb79d2ff9748be9474977852db989d4de489546526683e840c501249823a4bf

次のコマンドを使用して実行中のコンテナを確認することもできます:

podman ps

次の出力が表示されるはずです:

CONTAINER ID  IMAGE                            COMMAND  CREATED         STATUS             PORTS   NAMES
5fb79d2ff974  docker.io/library/debian:latest  bash     29 seconds ago  Up 28 seconds ago          debian-container

実行中のコンテナに接続するには、次のコマンドを実行します:

podman attach debian-container

接続されると、次の出力が表示されるはずです:

root@5fb79d2ff974:/#

実行中のコンテナ内で任意のコマンドを実行することもできます:

root@5fb79d2ff974:/# apt-get update

Debianコンテナから退出するには、次のコマンドを実行します:

root@5fb79d2ff974:/# exit

実行中のコンテナのログを確認するには、次のコマンドを実行します:

podman logs -f debian-container

実行中のコンテナを停止するには、次のコマンドを実行します:

podman stop debian-container

停止したコンテナを削除するには、次のコマンドを実行します:

podman rm debian-container

Podmanでポッドを管理する

このセクションでは、Podmanを使用してポッドを管理する方法を示します。

webserverという名前の新しいポッドを作成するには、次のコマンドを実行します:

podman pod create --name webserver

次の出力が表示されるはずです:

9cc9b2bdcfe1b774129f2d5b50a4b52c746a0f8917780ae7f2c786fa7767cd19

すべてのポッドをリストするには、次のコマンドを実行します:

podman pod list

次の出力が表示されるはずです:

POD ID        NAME       STATUS   CREATED         INFRA ID      # OF CONTAINERS
9cc9b2bdcfe1  webserver  Created  21 seconds ago  3a0c7750fed9  1

ポッド内の実行中のコンテナを確認するには、次のコマンドを実行します:

podman ps -a --pod

次の出力が表示されるはずです:

CONTAINER ID  IMAGE                                         COMMAND  CREATED         STATUS   PORTS   NAMES               POD ID        PODNAME
3a0c7750fed9  registry.access.redhat.com/ubi8/pause:latest           38 seconds ago  Created          9cc9b2bdcfe1-infra  9cc9b2bdcfe1  webserver

ポッドに新しいCentOSコンテナを追加するには、次のコマンドを実行します:

podman run -dt --pod webserver centos:latest top

次の出力が表示されるはずです:

Resolved "centos" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull quay.io/centos/centos:latest...
Getting image source signatures
Copying blob 7a0437f04f83 done  
Copying config 300e315adb done  
Writing manifest to image destination
Storing signatures
fcd9a724097759c29330bd57e557eab9778b3d6736695ebf9afedfbd9c0db5e3

追加したコンテナを確認するには、次のコマンドを実行します:

podman ps -a --pod

次の出力が表示されるはずです:

CONTAINER ID  IMAGE                                         COMMAND  CREATED             STATUS             PORTS   NAMES                 POD ID        PODNAME
3a0c7750fed9  registry.access.redhat.com/ubi8/pause:latest           About a minute ago  Up 16 seconds ago          9cc9b2bdcfe1-infra    9cc9b2bdcfe1  webserver
fcd9a7240977  quay.io/centos/centos:latest                  top      17 seconds ago      Up 16 seconds ago          recursing_goldwasser  9cc9b2bdcfe1  webserver

結論

上記のガイドでは、CentOS 8でコンテナを管理するためにPodmanをインストールして使用する方法を学びました。PodmanはDockerに非常に似ており、作業を簡単にするための優れた代替手段です。

Share: X/Twitter LinkedIn

新しい投稿を受信箱で受け取る

スパムはありません。いつでも購読を解除できます。