Run Couchbase as non-root user and set data volume

Updates the Dockerfile to change ownership of /opt/couchbase/var, declare it as a volume, and run the container as the 'couchbase' user for improved security and data persistence.
This commit is contained in:
tiennm99 committed 2025-10-05 01:07:42 +07:00
1 parent 3fc914a795
commit e1884fe1a6
1 file changed
+5
+5
View File
@@ -19,7 +19,12 @@ RUN apt-get install -y librtmp0
RUN groupadd -g 1000 couchbase && useradd couchbase -u 1000 -g couchbase -M
RUN export INSTALL_DONT_START_SERVER=1 && \
dpkg -i ./$CB_PACKAGE && rm -f ./$CB_PACKAGE
RUN chown -R couchbase:couchbase /opt/couchbase/var
EXPOSE 8091 8092 11210 11211
VOLUME /opt/couchbase/var
USER couchbase
CMD ["couchbase-server", "--", "-noinput"]