Run Docker container as non-root user with uid 1000

This commit is contained in:
2025-12-05 23:06:24 +01:00
parent f4c5b19b5c
commit 1011213c06

View File

@@ -13,10 +13,17 @@ WORKDIR /app
COPY thinkcenter_monitor.sh /app/thinkcenter_monitor.sh
# Create log directory
RUN mkdir -p /var/log
RUN mkdir -p /var/log && chmod 755 /var/log
# Make script executable
RUN chmod +x /app/thinkcenter_monitor.sh
# Create a non-root user with uid 1000
RUN adduser -u 1000 -s /sbin/nologin -D appuser && \
chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Set the entrypoint
CMD ["/app/thinkcenter_monitor.sh"]