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

OpenShift start build failing expecting a numeric user value #46

Open
imranzunzani opened this issue Jun 7, 2019 · 5 comments
Open

Comments

@imranzunzani
Copy link

On OpenShift build (binary), the images are generating the following error:
'must specify a user that is numeric and within the range of allowed users'

while the images from:

https://hub.docker.com/r/fabric8/s2i-java

are working fine.

@imranzunzani
Copy link
Author

These images are not s2i compatible. As Alpine's jre has the smallest footprint (just jre) and overall image size, I found the following way to run the image:

  1. Created image with Dockerfile:

FROM fabric8/java-alpine-openjdk8-jre:1.6.3

LABEL io.k8s.description="Platform for building and running plain Java applications (fat-jar and flat classpath)" \
      io.k8s.display-name="Java Applications" \
      io.openshift.tags="builder,alpine-java" \
      io.openshift.s2i.scripts-url="image:///usr/local/s2i" \
      io.openshift.s2i.destination="/tmp"

ADD s2i /usr/local/s2i

RUN chmod 777 -R /deployments

USER 1001 

CMD [ "/deployments/run-java.sh" ]
  1. Used the s2i files in the ADD from:
    fabric8io-images

  2. Modified the 'run' script to launch '/deployments/run-java.sh' at the end.

The resultant image works with OpenShift's s2i.

@rhuss
Copy link
Contributor

rhuss commented Jun 9, 2019

Why don't you just use https://github.com/fabric8io-images/s2i which is the S2I Java Builder image, whereas this image is meant to be as base images which you can tune as you like (e.e. setting an numeric UID) ?

@imranzunzani
Copy link
Author

I was looking for an Alpine base, because of the smaller size. The S2I section doesn't has one. I came across this one and it is running pretty sleek and good with the S2I labels and modifications. Could you please include an S2I compatible Alpine one, as that would be really nice to have?

Also, on a different note:
The latest JDK/JRE for 8 and above now have the XX:+UseContainerSupport enabled by default which computes the memory (heap) and proc values based on settings for the container. So, the run-java.sh could be simplified and relieved of these calculations.
Reference

@rhuss
Copy link
Contributor

rhuss commented Jun 9, 2019

This image does not contain and will never contain any S2I scripts. Feel free to open an issue over there at https://github.com/fabric8io-images/s2i for an alpine based image.

Thanks for the heads up wrt/ the updates on the latest JDK. Happy to take PRs to improve the scripts.

@imranzunzani
Copy link
Author

I have sent the PR to merge.
Please check.

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

No branches or pull requests

2 participants