krallin / tini

A tiny but valid `init` for containers
MIT License
9.82k stars 507 forks source link

[FATAL tini (7)] exec bash failed: No such file or directory #209

Closed alifiroozi80 closed 1 year ago

alifiroozi80 commented 1 year ago

Hello guys,

I have a Dockerfile which uses the tini. Everything is okay if I build the image as usual (docker build -t test:1.0.0 .).

Now I'm using slim to shrink the image size.

This method will delete the dependencies of the tini so, as the docs say:

Tini has very few dependencies (it only depends on libc), but if your container fails to start, you might want to consider using the statically-built version instead

I change the Dockerfile from:

[...]
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
[...]

To:

[...]
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini
RUN chmod +x /tini
[...]

So it should run fine.


But after installation, something needs to be fixed!

E.g.

$ docker run --rm -it 2b1ea6590896 bash
[FATAL tini (7)] exec bash failed: No such file or directory

P.S.: I know the bash is installed on my container. The same command works fine if I don't shrink the image.

krallin commented 1 year ago

Bash might not be on your PATH, or it might not exist at all in your image.

Tini is working fine here, that’s not a library problem, since it gets as far as a executing your binary.

P.S.: I know the bash is installed on my container. The same command works fine if I don't shrink the image

Sounds a lot like “shrinking” your image deleted bash.

On Sat, 25 Feb 2023 at 10:09, Ali @.***> wrote:

Hello guys,

I have a Dockerfile which uses the tini. Everything is okay if I build the image as usual (docker build -t test:1.0.0 .).

Now I'm using slim https://github.com/slimtoolkit/slim to shrink the image size.

This method will delete the dependencies of the tini so, as the docs say:

Tini has very few dependencies (it only depends on libc), but if your container fails to start, you might want to consider using the statically-built version instead

I change the Dockerfile from:

[,,,]ENV TINI_VERSION v0.19.0ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tiniRUN chmod +x /tini [...]

To:

[,,,]ENV TINI_VERSION v0.19.0ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tiniRUN chmod +x /tini [...]

So it should run fine.

But after installation, something needs to be fixed!

E.g.

$ docker run --rm -it 2b1ea6590896 bash [FATAL tini (7)] exec bash failed: No such file or directory

P.S.: I know the bash is installed on my container. The same command works fine if I don't shrink the image.

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

krallin commented 1 year ago

Do bear in mind that Tini itself does depend on bash. If it’s running bash that’s because you’re asking it to do so.

As a next step, I would suggest double checking what actually is in your image

On Sat, 25 Feb 2023 at 10:41, Thomas Orozco @.***> wrote:

Bash might not be on your PATH, or it might not exist at all in your image.

Tini is working fine here, that’s not a library problem, since it gets as far as a executing your binary.

P.S.: I know the bash is installed on my container. The same command works fine if I don't shrink the image

Sounds a lot like “shrinking” your image deleted bash.

On Sat, 25 Feb 2023 at 10:09, Ali @.***> wrote:

Hello guys,

I have a Dockerfile which uses the tini. Everything is okay if I build the image as usual (docker build -t test:1.0.0 .).

Now I'm using slim https://github.com/slimtoolkit/slim to shrink the image size.

This method will delete the dependencies of the tini so, as the docs say:

Tini has very few dependencies (it only depends on libc), but if your container fails to start, you might want to consider using the statically-built version instead

I change the Dockerfile from:

[,,,]ENV TINI_VERSION v0.19.0ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tiniRUN chmod +x /tini [...]

To:

[,,,]ENV TINI_VERSION v0.19.0ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tiniRUN chmod +x /tini [...]

So it should run fine.

But after installation, something needs to be fixed!

E.g.

$ docker run --rm -it 2b1ea6590896 bash [FATAL tini (7)] exec bash failed: No such file or directory

P.S.: I know the bash is installed on my container. The same command works fine if I don't shrink the image.

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

alifiroozi80 commented 1 year ago

Hello @krallin Thank you for your quick response. You were right! After I added the --include-shell flag to the slim during the shrinking, it is now working, and it's not tini fault! Thank you, sir, for this excellent tool