Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] image "true" #1893

Closed
lonix1 opened this issue Oct 9, 2019 · 5 comments
Closed

[Feature Request] image "true" #1893

lonix1 opened this issue Oct 9, 2019 · 5 comments
Labels

Comments

@lonix1
Copy link

lonix1 commented Oct 9, 2019

There is a handy and highly popular image named tianon/true. Used in testing, deployment, etc.

There are already a number of official images, such as hello-world.

Please add this sort of image as true, and a corresponding one as false. It's easier to remember and use, without an organization name. And it's the sort of image that will never need to be updated.

@github-actions
Copy link

github-actions bot commented May 8, 2021

We are clearing up our old issues and your ticket has been open for one year with no activity. Remove stale label or comment or this will be closed in 15 days.

@github-actions github-actions bot added the Stale label May 8, 2021
@lonix1
Copy link
Author

lonix1 commented May 8, 2021

Still relevant today. Official true and false images are very useful, and would never need to be maintained.

@github-actions github-actions bot removed the Stale label May 8, 2021
@tianon
Copy link

tianon commented May 17, 2021

This is very flattering. 😄

I'm really curious, what is the use case for a true or false image? Honestly, I've found tianon/sleeping-beauty more useful than tianon/true in practice (both were honestly created out of sheer "can we do this?" more than usefulness) -- I use sleeping-beauty for tricking Docker into thinking my volumes or networks are still "in use" so that I don't accidentally prune them. 😂

If we go back in time in the hello-world image's history, we can see that it looks very familiar to anyone who has looked under the hood of tianon/true: https://github.com/docker-library/hello-world/blob/e968841b4ed61e28224e750cfbde6d77523f47aa/hello.asm (compare to https://github.com/tianon/dockerfiles/blob/eabfe1b9763dea0dfba4dae232c1633f27f9753e/true/true.asm), and that's very much not an accident. 😄

Eventually, hello-world was re-written in C (docker-library/hello-world#17) which increased the binary size a bit but meant it could more easily be supported across multiple architectures (although it took a little bit longer for that dream to become fully realized; docker-library/hello-world#31).

We have a busybox image which is pretty small -- if you really want/need a container which simply exits immediately, I would suggest that one (docker run --rm busybox true vs docker run --rm busybox false -- you can even get creative if you want some other specific exit code: docker run --rm busybox sh -c 'exit 42'). That being said though, I'm still really confused what the use case is and would love some more details. 👍

@lonix1
Copy link
Author

lonix1 commented May 18, 2021

To be honest I can't remember the use case! It was obvious to me until I tried to remember what it was and I can't. I searched my codebase but couldn't find it, so I must have replaced it with some workaround since then.

I think it was for data-only containers but there are workarounds.

It was also useful for compose file overrides, but now there's the "profiles" feature.

Another reason is for debugging, sometimes you just want to see whether something works (hacking together a compose file), and the smallest possible image is best.

A container that exits immediately can be done with busybox, true (excude the pun), but it's easier with a "true" image instead. But using busybox is not so difficult as you pointed out - and of course we still have the trusty tianon/true image.

It's interesting to note that dockerhub has 5M downloads for your image! Not bad for something you didn't think would be useful... it was/is! I wonder what they are using it for?!?!

@Skeen anything to add?

@github-actions
Copy link

We are clearing up our old issues and your ticket has been open for 6 months with no activity. Remove stale label or comment or this will be closed in 15 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants