-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
When generating container names, podman picks the same name every time #15569
Comments
Our random names generator uses the Golang standard library RNG (the standard one, not the cryptographically secure one, as names aren't exactly security critical). However, it does not actually seed the random number generator; it looks like we relied on other parts of the program that also used the RNG to do so, but it seems that all of them have stopped doing so (it looks like c/storage's Solution would be to re-add seeding somewhere. |
@mheon where would you add the seeding? |
Its not clear what the right place is. Putting it somewhere in the CLI would add a requirement for other users of libpod to seed the RNG which changes the contract. The best approach might be for Runtime to create its own RNG and change GetRandomName to take that as a parameter but that requires changing github.com/docker/docker. The simplest just adds a call to rand.Seed in (*Runtime).generateName. |
I built v4.2.0 this morning to check and it does show this problem. |
@vrothberg Probably Libpod's |
Fixes containers#15569. Signed-off-by: Doug Rabson <[email protected]>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
With podman 4.1.0, when creating a container without an explicit name, a randomly generated name is created each time:
With the latest dev build (built from hash 8266dbe), I get the same name each time:
The reason is that c/storage/pkg/stringid changed to use its own RNG instead of sharing the global one. It seems that GetRandomName was benefiting from stringid's seeding of the global RNG.
Steps to reproduce the issue:
sudo podman run --rm -i fedora cat /etc/hosts
and note that the container name is always the same.Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
This was tested with podman build from the hash mentioned above. It seems likely that the problem is present in v4.2.0 but I haven't tested this.
The text was updated successfully, but these errors were encountered: