Problem
The runtime stage of the Dockerfile never drops root privileges. As a result, all files written to bind-mounted /data/* paths (outputs, checkpoints, logs, cache, splits) end up owned by root on the host, which is both a security concern (increases the container's blast radius) and a practical inconvenience.
Suggested fix
Add a dedicated non-root system user in the runtime stage, chown the application and data directories to that user, and add a USER directive before ENTRYPOINT:
RUN groupadd --system waterflow \
&& useradd --system --create-home --gid waterflow waterflow
# (after all COPY/mkdir steps)
RUN chown -R waterflow:waterflow /app /data
USER waterflow
ENTRYPOINT ["/app/entrypoint.sh"]
References
Problem
The runtime stage of the
Dockerfilenever drops root privileges. As a result, all files written to bind-mounted/data/*paths (outputs, checkpoints, logs, cache, splits) end up owned byrooton the host, which is both a security concern (increases the container's blast radius) and a practical inconvenience.Suggested fix
Add a dedicated non-root system user in the runtime stage,
chownthe application and data directories to that user, and add aUSERdirective beforeENTRYPOINT:References