rethinkdb-dockerfiles icon indicating copy to clipboard operation
rethinkdb-dockerfiles copied to clipboard

Do not run as root

Open cur3n4 opened this issue 8 years ago • 3 comments

Ideally the image should not be run as root, I recommend creating a user and changing the rethinkdb permissions to be accessible by that user

cur3n4 avatar Aug 01 '17 01:08 cur3n4

How many other official images run as a non-root user/group? My experience has been that, in the Docker world, the containerization itself is generally considered to be "good enough" in terms of privilege encapsulation.

If you can point to a substantial number of other prolific images in the official library that create and use non-root user accounts, I'd consider this, but even then, this would be an unlikely change, due to the potential to break backwards compatibility (usage in the wild having been written against the image under the assumption that commands will be run as root).

stuartpb avatar Aug 31 '17 18:08 stuartpb

In my experience the difference comes from when you have bind-mounted directories. I.e. all you mounted files would be root owned. In terms of security, I don't know what it means, but in terms of usability it has less than perfect user experience. You'll frequently get permission denied. For named volumes it's even worse: you have to run your container as root and chown the corresponding directories. And god help you if you have different user ids in different containers that need access to the same volume.

I don't see why you should change rethinkdb base image, as you can easily create an official-derived image:

FROM rethinkdb
USER rethinkdb
RUN useradd ...
RUN chown rethinkdb ...

Vanuan avatar Sep 06 '17 22:09 Vanuan

I am in support of running the image as not-root. I currently build my own rethindkb-image so that I'm are able to run rethinkdb in OpenShift.

Openshifts documentation states how they recommend doing it: https://docs.openshift.com/container-platform/3.7/creating_images/guidelines.html#openshift-specific-guidelines

AFAIK, for deployments on Kubernetes, one would have to specify allowPrivileged to run the official rethinkdb image.

toredash avatar Jan 03 '18 10:01 toredash