简体   繁体   中英

setpgid: Operation not permitted on Docker

Any ideas why the following works (the Docker container runs without errors):

FROM alpine:3.14.0

RUN apk update && \
    apk --no-cache add dcron

COPY entry.sh /entry.sh
RUN chmod +x /entry.sh

CMD /entry.sh
# entry.sh
#!/bin/sh

# start cron
/usr/sbin/crond -f

While the following

FROM alpine:3.14.0

RUN apk update && \
    apk --no-cache add dcron

CMD /usr/sbin/crond -f

gives me the

cnt  | setpgid: Operation not permitted
cnt exited with code 1

What am I missing here?

I think that is related to alpine:3.14.0 . Check it out:

Try to update you Docker version

Looks like it has something with how Linux process group ID and session ID works (more details in credentials(7) ) and should be fixed in dcron.

At the moment dcron calls setpgid if started with -f option :

  • If dcron is started as PID1 in container - it works.
  • If dcron is started as non-PID1 in container - it also works.
  • But if some other process start as PID1 and then execve() to dcron - it doesn't work (setpgid returns EPERM for reasons explained in setpgid(2) ).

UPDATE: See https://github.com/dubiousjim/dcron/issues/13

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM