denoland / deno_docker

Latest dockerfiles and images for Deno - alpine, centos, debian, ubuntu
https://hub.docker.com/r/denoland/deno
MIT License
899 stars 101 forks source link

Tini warning when building 1.28.1 image #256

Open GJZwiers opened 1 year ago

GJZwiers commented 1 year ago

When building the denoland/deno image with docker build -t app . && docker run -it --init -p 1993:1993 app I get a warning on the terminal:

[WARN  tini (7)] Tini is not running as PID 1 and isn't registered as a child subreaper.
Zombie processes will not be re-parented to Tini, so zombie reaping won't work.
To fix the problem, use the -s option or set the environment variable TINI_SUBREAPER to register Tini as a child subreaper, or run Tini as PID 1.

This is the dockerfile being used:

FROM denoland/deno:1.28.1

EXPOSE 1993

WORKDIR /app

USER deno

COPY deps.ts .
RUN deno cache deps.ts

ADD . .
RUN deno cache main.ts

CMD ["run", "--allow-net", "main.ts"]

This does not happen if I use the version used on the Docker hub page which is 1.10.3

EdJoPaTo commented 1 year ago

--init already creates an init handler so tini is useless (which is why tini writes this warning).

Most processes (like Deno) are written to have a working init handler. Containers are meant to be pretty minimal so they only ship with the relevant processes. Container environments can add a pretty minimal init handler on run with --init which is the normal way of working with containers.

165 added an init handler to the deno container image. So running with --init results in having two init handlers running which is what tini complains about.

While I personally would prefer to use the container environment --init handler the simplest solution with deno containers is to omit the --init on run.

The old version you mentioned (1.10.3) was probably before tini was added to this image so there wasnt a conflict of two init handlers then.

GJZwiers commented 1 year ago

Thanks for looking into it! Running the image without --init works for me. The page on Docker Hub for the Deno image is where I got the command from but it may be outdated, i.e. the readme on https://github.com/denoland/deno_docker doesn't use --init in docker run anymore.

enjikaka commented 1 year ago

Also got this issue when upgrading from 1.25 to 1.30. I run Deno in Docker via Dokku and don't handle the containers myself; so quite weird to get the Tini message in my face like this. Added ENV TINI_SUBREAPER=true to my Dockerfile to remove the error.

rafrafek commented 4 months ago

@GJZwiers I think you're right, I created #370 to track it.