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

Dockerfile for a image that can be used in a pod on kubernetes #1972

Closed
wants to merge 6 commits into from

Conversation

Kraego
Copy link

@Kraego Kraego commented Jun 14, 2024

Kubernetes assigns a random user id to the pod, so the chown to worker in the present Dockerfiles won't be sufficient. In the new docker file the ownership is handeled with a group.

I've tested this on a openshift kubernetes cluster.

Hope it can help others.

@Kraego Kraego requested a review from grugqq June 19, 2024 19:00
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any limitation to have a separate Dockerfile for k8s?
It would be nice to merge your changes with the PR #1792. What do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No there is no limitation it also works in local docker stack, it's just the additional layers to set the permission via group instead of a specific user, to run as rootless docker container.
I've just created a separate dockerfile because there were already a external and local edition

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try with last version? This includes GID and UID :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not working on kubernetes. The UID to run the container is assigned by the node running the pod (https://www.redhat.com/en/blog/a-guide-to-openshift-and-uids). There is a kubernetes setting securityContext/runAsUser, but this feature is disabled on the cluster I'm working for safety concerns

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it related with openshift kubernetes?
I'm not sure if it's a native kubernetes feature or a Openshift one

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I‘ve looked it up. Its just a openshift thing (random UID). Vanilla kubernetes can run the docker container …

@Kraego Kraego closed this Aug 1, 2024
@jaluma
Copy link
Collaborator

jaluma commented Aug 6, 2024

Why did you reopened this PR?

@Kraego
Copy link
Author

Kraego commented Aug 7, 2024

Why did you reopened this PR?

I thought maybe as openshift variant. But if you like to close it, It's okay for me :-D

@jaluma jaluma closed this Aug 8, 2024
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