Skip to content

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