「Podman」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(翻訳)
 
(→‎参照: add == Troubleshooting ==)
85行目: 85行目:
   
 
利用可能なタグについては Docker Hub のページを見てください。各 Debian リリース毎に standard と slim バージョンが存在します。
 
利用可能なタグについては Docker Hub のページを見てください。各 Debian リリース毎に standard と slim バージョンが存在します。
  +
  +
== Troubleshooting ==
  +
  +
=== No image found ===
  +
  +
By default the registry list is not populated as the files in the package come from upstream. This means that by default, trying to pull any image without specifying the registry will result in an error similar to the following:
  +
  +
Error: short-name "archlinux" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf"
  +
  +
A starting configuration could be the following:
  +
  +
{{hc|1=/etc/containers/registries.conf.d/00-unqualified-search-registries.conf|2=
  +
unqualified-search-registries = ["docker.io"]
  +
}}
  +
  +
{{hc|1=/etc/containers/registries.conf.d/01-registries.conf|2=
  +
<nowiki>[[registry]]</nowiki>
  +
location = "docker.io"
  +
}}
  +
  +
This is equivalent to the default docker configuration.
  +
  +
=== Containers terminate on shell logout ===
  +
  +
It may happen that after logging out from machine, Podman containers are stopped. To prevent that, user lingering should be enabled for user running containers:
  +
  +
$ loginctl enable-linger
  +
  +
You can also create user systemd unit as described: https://docs.podman.io/en/latest/markdown/podman-auto-update.1.html#examples
  +
  +
=== Error when creating a container with bridge network in rootless mode ===
  +
  +
If you are using [[AppArmor]] you might end up with problems when creating container using a bridge network with the {{ic|dnsname}} plugin enabled:
  +
  +
{{hc|$ podman network create foo|
  +
/home/''user''/.config/cni/net.d/foo.conflist
  +
}}
  +
  +
{{hc|1=$ podman run --rm -it --network=foo docker.io/library/alpine:latest ip addr|2=
  +
Error: command rootless-cni-infra [alloc 89398a9315256cb1938075c377275d29c2b6ebdd75a96b5c26051a89541eb928 foo festive_hofstadter ] in container 1f4344bbd1087c892a18bacc35f4fdafbb61106c146952426488bc940a751efe failed with status 1, stdout="", stderr="exit status 3\n"
  +
}}
  +
  +
This can be solved by adding the following lines to {{ic|/etc/apparmor.d/local/usr.sbin.dnsmasq}}:
  +
  +
owner /run/user/[0-9]*/containers/cni/dnsname/*/dnsmasq.conf r,
  +
owner /run/user/[0-9]*/containers/cni/dnsname/*/addnhosts r,
  +
owner /run/user/[0-9]*/containers/cni/dnsname/*/pidfile rw,
  +
  +
And then reloading the AppArmor profile:
  +
  +
# apparmor_parser -R /etc/apparmor.d/usr.sbin.dnsmasq
  +
# apparmor_parser /etc/apparmor.d/usr.sbin.dnsmasq
  +
  +
=== Error on commit in rootless mode ===
  +
  +
Error committing the finished image: error adding layer with blob "sha256:02823fca9b5444c196f1f406aa235213254af9909fca270f462e32793e2260d8": Error processing tar file(exit status 1) permitted operation
  +
  +
Check that the storage driver is overlay in the [[#Storage]] configuration.
  +
  +
=== Error building pause image after Podman upgrade 3.x to 4.0 ===
  +
  +
Error: building local pause image: finding pause binary: exec: "catatonit": executable file not found in $PATH
  +
  +
[[Install]] the {{Pkg|catatonit}} package to fix the error.
  +
  +
For details on upgrading from 3.x to 4.0, see the official [https://podman.io/blogs/2022/02/04/network-usage.html blog article]
  +
  +
=== Container dns will not be enabled ===
  +
  +
WARN[0000] binary not found, container dns will not be enabled
  +
  +
If you installed {{Pkg|netavark}} as podman network backend you need to install {{Pkg|aardvark-dns}}
  +
  +
=== failed to move rootless netns ===
  +
  +
{{hc|1=docker-compose up|2= ERRO[0000] failed to move the rootless netns slirp4netns process to the systemd user.slice: Process org.freedesktop.systemd1 exited with status 1}}
  +
  +
Can be solved by [[starting/enabling]] {{ic|podman.service}}.
  +
  +
=== Permission denied: OCI permission denied ===
  +
  +
{{hc|1=podman exec openvas_openvas_1 bash|2=Error: crun: writing file `/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/user.slice/libpod-b3e8048a9b91e43c214b4d850ac7132155a684d6502e12e22ceb6f73848d117a.scope/container/cgroup.procs`: Permission denied: OCI permission denied}}
  +
  +
Can be solved: https://bbs.archlinux.org/viewtopic.php?id=253966
  +
  +
env DBUS_SESSION_BUS_ADDRESS= podman ...
  +
env DBUS_SESSION_BUS_ADDRESS= podman-compose ...
  +
  +
=== Add pause to process ===
  +
  +
WARN[0000] Failed to add pause process to systemd sandbox cgroup: Process org.freedesktop.systemd1 exited with status 1
  +
  +
Can be solved using: https://github.com/containers/crun/issues/704
  +
  +
# echo +cpu +cpuset +io +memory +pids > /sys/fs/cgroup/cgroup.subtree_control
   
 
== 参照 ==
 
== 参照 ==

2022年4月15日 (金) 18:15時点における版

関連記事

Podman は Docker の代わりになるプログラムで、同じようなインターフェイスを提供します。

インストール

podman パッケージをインストールしてください。コンテナイメージを作成したい場合は Buildah も見てください。

Docker と異なり、Podman はデーモンを必要としませんが、cockpit-podman など cockpit のようなサービスのための API は提供しています。

デフォルトでは Podman を実行できるのは root だけです。root 以外のユーザーでコンテナを実行したい場合はルートレス Podman を参照。

設定

コンテナの挙動を設定する設定ファイルは /etc/containers に存在します。Podman によって使われるネットワークブリッジインターフェイスを設定したいときは /etc/cni/net.d/87-podman-bridge.conflist を見てください。

ルートレス Podman

デフォルトではコンテナ (カーネルの文脈で言うところの名前空間) を実行できるのは root だけです。

Podman コンテナを root を使わずに操作したい場合、まずコンテナを使いたいユーザーとグループを決めて、適切なエントリを /etc/subuid/etc/subgid に追加してください。

以下の例では podman ユーザーとグループによる Podman コンテナの実行を有効化します。165536 から 169631 までの UID/GID が podman ユーザー・グループにそれぞれ割り当てられます。詳しくは subuid(5)subgid(5) を見てください。

/etc/subuid
podman:165536:4096
/etc/subgid
podman:165536:4096

上記の設定後、podman ユーザー・グループで podman コンテナを起動できるようになります。

イメージ

ノート: イメージのレジストリプレフィックスは省略できます。Podman は /etc/containers/registries.confregistries.search に定義されている全てのレジストリからイメージを自動で (定義されている順番で) 検索します。以下に記述しているイメージは設定に docker.io がなくても使えるように全てプレフィックスを付けています。

Arch Linux

以下のコマンドで Arch Linux x86_64 イメージが Docker Hub から取得されます。ネットワークなどを除外した縮小版の Arch となっています。

# podman pull docker.io/archlinux

README.md も参照してください。

完全な Arch イメージを使いたい場合、リポジトリを複製して自分自身のイメージを作成してください。

$ git clone https://github.com/archlinux/archlinux-docker.git

devtools パッケージをインストールしてください。

packages ファイルを編集して 'base' とだけ記述し、以下のコマンドを実行:

# make rootfs
# podman build -t archlinux .

Alpine Linux

Alpine Linux はコンテナイメージとして容量が小さく、静的バイナリとしてコンパイルされたソフトウェアに適しています。以下のコマンドで最新の Alpine Linux イメージが Docker Hub から取得されます:

# podman pull docker.io/alpine

Alpine Linux はほとんどの Linux ディストリビューションで使われている glibc libc 実装の代わりに musl libc 実装を使っています。Arch Linux は glibc を使っているため、Arch Linux ホストと Alpine Linux コンテナにはパフォーマンスからソフトウェアの正確性まで様々な影響がある違いが存在します。C ライブラリの差異については こちら に記述されています。

Arch Linux (や glibc を使用する他の環境) で動的リンクでビルドしたソフトウェアは Alpine Linux (や他の libc を使用する環境) で実行したときにバグやパフォーマンスの問題が発生する可能性があります。例としては [1], [2], [3] を見てください。

CentOS

以下のコマンドによって最新の Centos イメージが Docker Hub から取得されます:

# podman pull docker.io/centos

CentOS のリリースを指定するタグについては Docker Hub のページを見てください。

Debian

以下のコマンドによって最新の Debian イメージが Docker Hub から取得されます:

# podman pull docker.io/debian

利用可能なタグについては Docker Hub のページを見てください。各 Debian リリース毎に standard と slim バージョンが存在します。

Troubleshooting

No image found

By default the registry list is not populated as the files in the package come from upstream. This means that by default, trying to pull any image without specifying the registry will result in an error similar to the following:

Error: short-name "archlinux" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf"

A starting configuration could be the following:

/etc/containers/registries.conf.d/00-unqualified-search-registries.conf
unqualified-search-registries = ["docker.io"]
/etc/containers/registries.conf.d/01-registries.conf
[[registry]]
location = "docker.io"

This is equivalent to the default docker configuration.

Containers terminate on shell logout

It may happen that after logging out from machine, Podman containers are stopped. To prevent that, user lingering should be enabled for user running containers:

$ loginctl enable-linger

You can also create user systemd unit as described: https://docs.podman.io/en/latest/markdown/podman-auto-update.1.html#examples

Error when creating a container with bridge network in rootless mode

If you are using AppArmor you might end up with problems when creating container using a bridge network with the dnsname plugin enabled:

$ podman network create foo
/home/user/.config/cni/net.d/foo.conflist
$ podman run --rm -it --network=foo docker.io/library/alpine:latest ip addr
Error: command rootless-cni-infra [alloc 89398a9315256cb1938075c377275d29c2b6ebdd75a96b5c26051a89541eb928 foo festive_hofstadter    ] in container 1f4344bbd1087c892a18bacc35f4fdafbb61106c146952426488bc940a751efe failed with status 1, stdout="", stderr="exit status 3\n"

This can be solved by adding the following lines to /etc/apparmor.d/local/usr.sbin.dnsmasq:

owner /run/user/[0-9]*/containers/cni/dnsname/*/dnsmasq.conf r,
owner /run/user/[0-9]*/containers/cni/dnsname/*/addnhosts r,
owner /run/user/[0-9]*/containers/cni/dnsname/*/pidfile rw,

And then reloading the AppArmor profile:

# apparmor_parser -R /etc/apparmor.d/usr.sbin.dnsmasq
# apparmor_parser /etc/apparmor.d/usr.sbin.dnsmasq

Error on commit in rootless mode

Error committing the finished image: error adding layer with blob "sha256:02823fca9b5444c196f1f406aa235213254af9909fca270f462e32793e2260d8": Error processing tar file(exit status 1) permitted operation

Check that the storage driver is overlay in the #Storage configuration.

Error building pause image after Podman upgrade 3.x to 4.0

Error: building local pause image: finding pause binary: exec: "catatonit": executable file not found in $PATH

Install the catatonit package to fix the error.

For details on upgrading from 3.x to 4.0, see the official blog article

Container dns will not be enabled

WARN[0000]  binary not found, container dns will not be enabled

If you installed netavark as podman network backend you need to install aardvark-dns

failed to move rootless netns

docker-compose up
ERRO[0000] failed to move the rootless netns slirp4netns process to the systemd user.slice: Process org.freedesktop.systemd1 exited with status 1

Can be solved by starting/enabling podman.service.

Permission denied: OCI permission denied

podman exec openvas_openvas_1 bash
Error: crun: writing file `/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/user.slice/libpod-b3e8048a9b91e43c214b4d850ac7132155a684d6502e12e22ceb6f73848d117a.scope/container/cgroup.procs`: Permission denied: OCI permission denied

Can be solved: https://bbs.archlinux.org/viewtopic.php?id=253966

env DBUS_SESSION_BUS_ADDRESS= podman ...
env DBUS_SESSION_BUS_ADDRESS= podman-compose ...

Add pause to process

WARN[0000] Failed to add pause process to systemd sandbox cgroup: Process org.freedesktop.systemd1 exited with status 1 

Can be solved using: https://github.com/containers/crun/issues/704

# echo +cpu +cpuset +io +memory +pids > /sys/fs/cgroup/cgroup.subtree_control

参照