-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Most public images used in devfile registry do not work as the base for Che 7 workspaces on OpenShift #13454
Comments
cc: @l0rd I'd like your thoughts since you're familiar with these issues. |
@amisevsk great analysis! And that's super important for the UX hence I am happy that you have dug the problem. Here are my comments: We should use openshift-compatible images only (group root can write /etc/passwd) Overriding the entrypoint to set patch /etc/passwd - type: dockerimage
image: centos:centos7
command: ["fail"]
args: ["-f", "/dev/null"]
arbitraryUserSupport: true
memoryLimit: 50Mi |
Maybe I'm naive here, but to me, this sounds like a problem in OpenShift. The problem is not that they run the container as a random user, but that this user does not conform to the expectations unix programs make of a user. In an ideal world, OpenShift would fix this. Do we have an issue open with them and is there a response? |
@tsmaeder the thing is that these problems are fixed on S2I images like |
Initial PR with patched Dockerfile has been merged to devfile registry eclipse-che/che-devfile-registry#24 |
PR patching all currently used images (except for one based off alpine): eclipse-che/che-devfile-registry#38 |
@amisevsk is there some issue with patching 'alpine' based community images or it is just not yet done? |
@ibuziuk There is, but sadly the discussion is split over 4-5 PRs/issues. The alpine image does not ship with
I think the second option (move to debian) is cleanest, but I haven't tested or checked if there are further issues. It shouldn't cause problems since we already use debian-based devfiles elsewhere. |
@l0rd are you, in general, ok to switch the alpine images to debian in the devfile registry for Che 7 GA and do the arbitary user patch the same way as it is currently done for all the other images? |
@ibuziuk, speaking of split discussion: eclipse-che/che-devfile-registry#38 (comment) I'll open a PR to use a more convenient base image. |
Yes we should not use images that don't have bash
|
As a blocker for 7.0.0 I believe this issue can be closed, but in opening it I initially intended it to be solved by a more general solution (public images still do not work, and users will still run into problems trying to create their own devfiles -- we just have a workaround that fixes our use-case). |
@amisevsk I reworded this issue a bit to make it Che 7 specific. WDYT about closing this one and creating a separate one for the general use-case of public images as a language runtime on OpenShift? |
a separate issue for general use of language runtime images without patching on OpenShift v4 has been created - #14042 |
Description
OpenShift by default starts containers using a random UID for security purposes [1]. Since the UID to be used is not known at container creation time, there is no entry for the running user in
/etc/passwd
.This can cause a multitude of problems:
/bin/sh
; startingbash
results in the promptI have no name!@workspaceid $
/projects
.m2
repo (see '?' folder is created when building console-java-simple project using java-maven Che 7 stack #13451 and Add -Duser.home parameter to maven opts in java-maven stack #13453)The suggestions in [1] are
root
group. This is not a problem for directories mounted as volumes/etc/passwd
file should be writable by the root group. Then, an entrypoint script can execute something likeThe second point above is the issue -- images not created to run on OpenShift do not have a writeable
/etc/passwd
; further, since we normally overwrite container commands withsleep infinity
ortail -f /dev/null
, even images with an entrypoint that does what we need won't execute the script by default. Note that this is what's done when starting the default "Che 7" stack, which explains why it works.At this time, I don't see many good potential solutions; when running on OpenShift, the Che server could attempt to rewrite the recipe's container commands with the script above followed by whichever non-terminating command we like, but this would still require using compatible images in the devfile registry. It could also result in confusing errors if we're automatically rewriting entrypoints, and it's difficult to specify a script like above in the yaml list format used for container commands.
I'm currently working with trying to implement the above, but if anyone has better ideas, it'd be great to hear them.
[1]- https://docs.okd.io/3.11/creating_images/guidelines.html#openshift-specific-guidelines
Reproduction Steps
Start a Che 7 workspace other than the default dev image (e.g.
java-maven
), open a terminal, and typewhoami
OS and version:
Che 7 on any OpenShift
Diagnostics:
In most images, we have e.g.:
The text was updated successfully, but these errors were encountered: