LoginSignup
0
0

How to run systemd in a container(podman)

Posted at

Linuxのコンテナエンジン podman で、コンテナを systemd で起動する方法。
podman container の --systemdオプションは podman 固有なので docker では使えないことに注意。

  1. ホスト側でSELinuxが有効な場合は以下のコマンドを実行しておく
# setsebool -P container_manage_cgroup true

 
2. コンテナを起動 or 作成する

# podman container run --name <コンテナ名> --systemd=true -d <イメージ> /sbin/init
# podman container create --name <コンテナ名> --systemd=true <イメージ> /sbin/init

 
3. コンテナを作成した場合は起動する

# podman container start --name <コンテナ名>

 
4. コンテナに接続する場合

# podman container exec -it <コンテナ名> /bin/bash

podman container attach では接続できないので注意。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0