docker-library / cassandra

Docker Official Image packaging for Cassandra
Apache License 2.0
263 stars 281 forks source link

Configurable user uid for cassandra #227

Closed iosonogio closed 3 years ago

iosonogio commented 3 years ago

The cassandra image is prepared with a user 'cassandra' having uid 999.

If the container is run on hosts without usernamespaces this can be problematic (at least messy) since another user with the same id may already exist on the host (like it happens on Centos/RedHat).

How about having a configurable user via an environment variable to set at build time?

tianon commented 3 years ago

Good catch! The ability to run as an arbitrary user was originally implemented in https://github.com/docker-library/cassandra/pull/48, but at some point along the way we started overwriting the configuration file even when it hasn't changed which unintentionally breaks that. I've filed #228 with a fix. :smile:

tianon commented 3 years ago

Bit of a false start, but fixed in https://github.com/docker-library/cassandra/pull/229 :crossed_fingers:

iosonogio commented 3 years ago

Hey, that's great, thank you so much! Please make it available for both versions 4 and 3 (I'm currently using 3.11 which I guess it's the main stable version)

iosonogio commented 3 years ago

Sorry, I just saw that you implemented the fix for every version of cassandra! WOW Question: I see that uid 999 is still set fixed in the Dockerfile, will it suffice to run the container with the --user option to have cassandra run with a different user?

yosifkit commented 3 years ago

will it suffice to run the container with the --user option to have cassandra run with a different user?

Yes! (and, similarly, user: in docker-compose.yml, etc)