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

Update README.md: su-exec no longer needed on Alpine 3.8+ #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

am97
Copy link

@am97 am97 commented Jun 14, 2023

Hello,

The test on the README.md is no longer true on Alpine 3.8+

$ docker run --rm -it alpine:3.8 su postgres -c 'ps aux'
PID   USER     TIME  COMMAND
    1 postgres  0:00 ps aux

Seems to come from this Busybox commit: https://git.busybox.net/busybox/commit/?h=1_28_stable&id=1e3e2ccd5dd280371c9ca29c0e0304a0d40592af

On Debian 12, there are still forks that can be avoided with su-exec. Here is a simple test:

Dockerfile:

FROM debian:bookworm

RUN useradd postgres && \
    apt-get update && \
    apt-get install --no-install-recommends -y procps && \
    rm -rf /var/lib/apt/lists/*

Test:

$ docker run --rm -it bookworm_demo su postgres -c 'ps aux'
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  7.6  0.0   4120  2560 pts/0    Ss+  16:14   0:00 su postgres -c ps aux
postgres       7  0.0  0.0   2576  1536 ?        Ss   16:14   0:00 sh -c ps aux
postgres       8  0.0  0.0   8084  3840 ?        R    16:14   0:00 ps aux

The Debian case may be more relevant for su-exec users, I can modify this PR to put the previous example instead of Alpine if you wish.

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

Successfully merging this pull request may close these issues.

1 participant