Cannot run container as non-root user
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the provided Quadlet service, containers.conf, and the systemctl --user start postgres command on RHEL 9. Reproduce the initdb: error: cannot be run as root failure for the PostgreSQL 13/14/15 images and trace how the configured User=serviceuser is applied. Done means the container starts successfully as a non-root user.
Written by the indexing model from the issue text.
Description
Container platform
Podman/Docker
Version
rhel9/postgres-13 and postgres-15. maybe 14 too..
OS version of the container image
RHEL 9
Bugzilla, Jira
No response
Description
Podman is unable to run the container with quadlet as non-root user.
I have the following systemd-file:
## Quadlet Postgres Container Service File
[Unit]
Description=Postgres Container
[Container]
Image=repo/rhel9/postgresql-15:1-28
Volume=/opt/service/postgres/data:/var/lib/pgsql/data
User=serviceuser
ContainerName=postgres
Environment=POSTGRESQL_USER=serviceuser
Environment=POSTGRESQL_PASSWORD=pw
Environment=POSTGRESQL_DATABASE=service
Environment=POSTGRESQL_ADMIN_PASSWORD=adminpw
PublishPort=5432:5432
[Service]
WorkingDirectory=/opt/home/serviceuser
Restart=always
Environment=REGISTRY_AUTH_FILE=/opt/home/serviceuser/auth_zar.json
My containers.conf
.config/containers/containers.conf
# Please refer to containers.conf(5) for details of all configuration options.
# Precedence order:
# 1. /usr/share/containers/containers.conf
# 2. /etc/containers/containers.conf
# 3. $HOME/.config/containers/containers.conf (Rootless containers ONLY)
[containers]
cgroupns = "private"
cgroups = "enabled"
cgroup_manager = "systemd"
ipcns = "private"
netns = "private"
pidns = "private"
utsns = "private"
tz = "local"
rootless_networking = "slirp4netns"
after starting as non-root:
#systemctl --user start postgres
...
Started Postgres Container.
Warning: Can't detect cpu quota from cgroups
Warning: Can't detect cpuset size from cgroups
initdb: error: cannot be run as root
initdb: hint: Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.
Reproducer
No response
- Dominant language
- PLpgSQL
- Stars
- 178
- Forks
- 220
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sclorg/postgresql-container
-
Difficulty 2/5 1-2 days Newbie friendliness 72/100
sclorg/postgresql-container#661 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
sclorg/postgresql-container#669 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
sclorg/postgresql-container#668 ·
-
Dockerfile failing Open
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
sclorg/postgresql-container#656 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
sclorg/postgresql-container#654 ·
All issues in sclorg/postgresql-container
Similar issues
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
[BUG] A column whose default is the empty string is drawn in the ER diagram as having no default Openbug database-provider good first issue hacktoberfest
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
libredb/libredb-studio#1030 · 6 comments ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug redshift
Difficulty 2/5 1-3 hours Newbie friendliness 88/100