Run Docker container as non-root user with uid 1000
This commit is contained in:
@@ -13,10 +13,17 @@ WORKDIR /app
|
|||||||
COPY thinkcenter_monitor.sh /app/thinkcenter_monitor.sh
|
COPY thinkcenter_monitor.sh /app/thinkcenter_monitor.sh
|
||||||
|
|
||||||
# Create log directory
|
# Create log directory
|
||||||
RUN mkdir -p /var/log
|
RUN mkdir -p /var/log && chmod 755 /var/log
|
||||||
|
|
||||||
# Make script executable
|
# Make script executable
|
||||||
RUN chmod +x /app/thinkcenter_monitor.sh
|
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
|
# Set the entrypoint
|
||||||
CMD ["/app/thinkcenter_monitor.sh"]
|
CMD ["/app/thinkcenter_monitor.sh"]
|
||||||
|
|||||||
Reference in New Issue
Block a user