6.5. 永久更改容器运行时
您可以以 root 用户身份在 /etc/containers/containers.conf 配置文件中设置容器运行时及其选项,或者以非 root 用户身份在 $HOME/.config/containers/containers.conf 配置文件中设置容器运行时及其选项。
注意
<runtime> 可以是 crun 或 runc 运行时。
先决条件
-
container-tools元数据包已安装。
流程
更改
/etc/containers/containers.conf文件中的运行时:# vim /etc/containers/containers.conf [engine] runtime = "<runtime>"运行名为 myubi 的容器:
# podman run --name=myubi -dt ubi9 bash Resolved "ubi9" as an alias (/etc/containers/registries.conf.d/001-rhel-shortnames.conf) Trying to pull registry.access.redhat.com/ubi9:latest… ... Storing signatures
验证
确保
myubi容器中的 OCI 运行时设为<runtime>:# podman inspect myubi --format "{{.OCIRuntime}}" <runtime>