krallin / tini

A tiny but valid `init` for containers
MIT License
9.66k stars 505 forks source link

tini not running as child subreaper on AWS Lambda #218

Closed samkit-jain closed 8 months ago

samkit-jain commented 8 months ago

I have a Docker image that I have running on AWS Lambda and in that I am not able to run tini as a subreaper. It fails with the following error upon startup

[FATAL tini (9)] Failed to register as child subreaper: Operation not permitted

In my Dockerfile, I have installed tini as

FROM public.ecr.aws/lambda/python:3.10
# ... code here
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
RUN export TINI_SUBREAPER=
ENTRYPOINT ["/tini", "-s", "--", "/lambda-entrypoint.sh"]

-s or export TINI_SUBREAPER= was used because without it, tini runs as pid 8 (or anything but not 1)

How to make tini run as pid 1 on AWS Lambda?

krallin commented 8 months ago

You should try to work out what PID1 actually is in your container. It’s up to whatever PID1 is to let you take over as PID1.

Separately, if your environment does not allow registering as a subreaper there’s very little Tini can do about it I’m afraid.

On Tue, 21 Nov 2023 at 15:46, Samkit Jain @.***> wrote:

I have a Docker image that I have running on AWS Lambda and in that I am not able to run tini as a subreaper. It fails with the following error upon startup

[FATAL tini (9)] Failed to register as child subreaper: Operation not permitted

In my Dockerfile, I have installed tini as

ENV TINI_VERSION v0.19.0 ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini RUN chmod +x /tini RUN export TINI_SUBREAPER= ENTRYPOINT ["/tini", "-s", "--", "/lambda-entrypoint.sh"]

-s or export TINI_SUBREAPER= was used because without it, tini runs as pid 8 (or anything but not 1)

How to make tini run as pid 1 on AWS Lambda?

— Reply to this email directly, view it on GitHub https://github.com/krallin/tini/issues/218, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANIHVUUNCFPVYDBSLADLZ3YFS5D7AVCNFSM6AAAAAA7UWR7VGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYDINBUGYYTENI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

samkit-jain commented 8 months ago

Okay, thanks for the update. Closing this issue then. Will reach out to AWS Support.

f-dig commented 3 months ago

@samkit-jain: any luck with the AWS Support? I am facing the same issue with Tini on AWS Lambda

samkit-jain commented 3 months ago

Hi @f-dig No luck. Pid 1 is reserved in AWS Lambda and it will not work the way it is supposed to. Maybe the situation has changed now but for that you'll have to reach out the AWS support.