CentOS Stream 10
Sponsored Link

Podman : コンテナーイメージを登録する2025/01/21

 

コンテナー用のイメージファイルを新規登録するには以下のように設定します。

[1] 例として、公式からダウンロードした既存のイメージファイルのシステムに [httpd] をインストールして、[httpd] 入りのイメージを新規登録します。 コンテナーは [run] する毎に新しいものが生成されるため、コンテナー環境を最新化して [exit] した後に、直近のコンテナーを登録対象とします。
# 現在登録されているイメージ一覧を表示

[root@dlp ~]#
podman images

REPOSITORY             TAG         IMAGE ID      CREATED     SIZE
quay.io/centos/centos  stream10    1ef274445e32  6 days ago  311 MB

# 最新のイメージでコンテナーを起動し [httpd] をインストール

[root@dlp ~]#
podman run centos:stream10 /bin/bash -c "dnf -y upgrade; dnf -y install httpd"

[root@dlp ~]#
podman ps -a | tail -1

708bd79b91ed  quay.io/centos/centos:stream10  /bin/bash -c dnf ...  18 seconds ago  Exited (0) 10 seconds ago               happy_rhodes

# [httpd] インストール済みイメージを登録

[root@dlp ~]#
podman commit 708bd79b91ed srv.world/centos-httpd

Getting image source signatures
Copying blob 37e999dd80a5 skipped: already exists
Copying blob 28b680b9cfee done   |
Copying config ff38431822 done   |
Writing manifest to image destination
ff3843182253e2420e0e3f72dbf6af669a659c82118d261fd9577664811962be

# 確認

[root@dlp ~]#
podman images

REPOSITORY              TAG         IMAGE ID      CREATED         SIZE
srv.world/centos-httpd  latest      ff3843182253  19 seconds ago  354 MB
quay.io/centos/centos   stream10    1ef274445e32  6 days ago      311 MB

# 登録したイメージからコンテナーを生成し [httpd] 確認

[root@dlp ~]#
podman run srv.world/centos-httpd /usr/sbin/httpd -V

Server version: Apache/2.4.62 (CentOS Stream)
Server built:   Oct 29 2024 00:00:00
Server's Module Magic Number: 20120211:134
Server loaded:  APR 1.7.5, APR-UTIL 1.6.3, PCRE 10.44 2024-06-07
Compiled using: APR 1.7.5, APR-UTIL 1.6.3, PCRE 10.44 2024-06-07
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
.....
.....
関連コンテンツ