Skip to content

Commit

Permalink
Running as non root
Browse files Browse the repository at this point in the history
  • Loading branch information
mariadb-mmontes committed Apr 22, 2024
1 parent 1486f25 commit c4e69d8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ COPY --chmod=500 mariadb_repo_setup /tmp/mariadb_repo_setup
RUN /tmp/mariadb_repo_setup --mariadb-maxscale-version=${MXS_VERSION} --skip-check-installed

# Install MaxScale
RUN microdnf -y install maxscale && microdnf clean all
RUN microdnf -y install maxscale shadow-utils && microdnf clean all
COPY maxscale.cnf /etc/

# Copy licenses. Required for OpenShift container certification.
Expand All @@ -15,5 +15,13 @@ COPY LICENSE /licenses/
# Expose REST API port.
EXPOSE 8989

ENTRYPOINT ["maxscale","--nodaemon", "--user=root", "--log=stdout"]
# Create maxscale user
RUN useradd -r maxscale && \
chown maxscale:maxscale /var/{lib,run,log,cache}/maxscale

USER maxscale

VOLUME /var/lib/maxscale

ENTRYPOINT ["maxscale","--nodaemon", "--user=maxscale", "--log=stdout"]

0 comments on commit c4e69d8

Please sign in to comment.