######################################## Podman ######################################## podman 是无守护进程的容器管理。相比 Docker 而言,其突出优点是: - 无需守护服务 - 容器运行在用户空间而非 root 下 - 与 systemd 集成 另外,由于没有了守护服务,因此也变相加快了系统的启动时间 podman 的配置文件储存在 :file:`/etc/containers` 下和 :file:`${HOME}/.config/containers` 下 podman 和 podman-compose 在很大程度上可以与 docker 和 docker-compose 兼容 创建容器 **************************************** 在第一次使用 podman-compose 部署服务时,podman 会下载 k8s/pause,然而 gcr 的服务上不会,会导致卡死。这就需要手动下载一个 这个容器 :: podman pull k8simage/pause:3.5 podman tag docker.io/k8simage/pause:3.5 k8s.gcr.io/pause:3.5 开机启动容器 **************************************** podman 通过与 systemd 集成完成了对容器自启功能的需求。步骤为 :: mkdir -p $HOME/.config/systemd/user podman generate systemd -f -n whistle --new systemctl --user enable --now container-whistle.service 自动更新容器 **************************************** 要使 podman 可以自动更新容器,需要: - 在生成服务时添加 :command:`--new` 标志 - 在 docker-compose.yml 中添加以下内容: .. code-block:: yaml labels: io.containers.autoupdate: registry - 启动用户服务 *podman-auto-update.timer* 此外,还可以通过 *podman auto-update* 来验证容器是否加入到了自动更新中 .. seealso:: - `podman-auto-update(1) `_ - `podman-generate-systemd(1) `_ - https://github.com/containers/podman/pull/6858/commits/0ef5def0beb7f7e5f12db7c9fba1d1b7bb45ce73 - https://github.com/containers/podman/issues/6793 - https://github.com/containers/podman/pull/6858 挂载的数据卷无法访问 **************************************** 这个问题不知道为什么 audit 不会报错。但是确实是 SELinux 引起的。解决方法是修改文件上下文 :: chcon -Rt svirt_sandbox_file_t /data/ .. seealso:: - `Permission denied on accessing host directory in Docker `_ - `容器挂载volume出现“Permission denied”的问题定位解决 `_