Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run container as non-root user #532

Open
g4njawizard opened this issue Sep 26, 2023 · 0 comments
Open

Cannot run container as non-root user #532

g4njawizard opened this issue Sep 26, 2023 · 0 comments

Comments

@g4njawizard
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant