Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run image as a non-root user by default #487

Closed
wants to merge 1 commit into from
Closed

Run image as a non-root user by default #487

wants to merge 1 commit into from

Conversation

chgl
Copy link
Contributor

@chgl chgl commented Oct 31, 2020

Follow up from #442, using the correct branches this time 😅.

The changes were tested using a custom image build (see https://hub.docker.com/layers/chgl/akhq/0.15.0-rootless/images/sha256-daf750aa2e94e1c3a75b91faf5df08bdda4d6ef8dcf70cd8df7e02cc8b2acfd5?context=explore) and akhq is currently running as a non-root user set via securityContext in a production cluster.

@tchiotludo tchiotludo closed this in 7a14c0e Nov 4, 2020
@tchiotludo
Copy link
Owner

Sorry for the noise about branch but Docker image is better on dev & helm chart on master.
I've added the non root on dev to avoid to publish a new latest docker image

@thomas-chauvet
Copy link
Contributor

Hi,

Apologies in advance if this is not the right place to comment (I am not a real open-source contributor).

To avoid a user with no name it would be probably better to create a user first.

In docker, with a user with no name you will end with I have no name!@5af14cf2a980:/app$.

One solution could be:

FROM openjdk:11-jre-slim

WORKDIR /app
COPY docker /
ENV MICRONAUT_CONFIG_FILES=/app/application.yml

# Create user
RUN useradd -ms /bin/bash akhq

# Chown to write configuration
RUN chown -R akhq /app

USER akhq

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["./akhq"]

Happy to make a PR if needed :)

@tchiotludo
Copy link
Owner

I agree also :) PR are welcome 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants