Ubuntu 22.04 使用 Podman 部署 OpenGrok 的详细教程

安装必要的依赖:

官方镜像会在报错的时候暴露 Tomcat 10 版本号,错误堆栈,构成安全隐患,我们需要通过构建自定义镜像解决此问题:

修改后的完整内容如下:

构建镜像:

设置容器:

查看启动文件:

内容如下:

需要额外注意的一个地方是,给出的路径必须是完整路径 “/home/podman/.dockers/opengrok/Android_4.2.2/src”,不能是 “~/.dockers/opengrok/Android_4.2.2/src”,Systemd不能正确展开 “~” ,导致路径找不到,从而在启动的时候失败,报告错误代码 125 。

另外,Android源代码目录下不能存在 .svn .git  隐藏子目,我们需要手工删除,否则会报错。参考 删除目录下所有的 .svn .git 隐藏子目

Systemd 配置,开机/重启自动启动服务:

Running containers with resource limits fails with a permissions error

On some systemd-based systems, non-root users do not have resource limit delegation permissions. This causes setting resource limits to fail.

Symptom

Running a container with a resource limit options will fail with an error similar to the following:

--cpus--cpu-period--cpu-quota--cpu-shares:

--cpuset-cpus--cpuset-mems:

This means that resource limit delegation is not enabled for the current user.

Solution

You can verify whether resource limit delegation is enabled by running the following command:

Example output might be:

In the above example, cpu and cpuset are not listed, which means the current user does not have permission to set CPU or CPUSET limits.

If you want to enable CPU or CPUSET limit delegation for all users, you can create the file /etc/systemd/system/user@.service.d/delegate.conf with the contents:

After logging out and logging back in, you should have permission to set CPU and CPUSET limits.

参考链接


发布者

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注