A base image for java applications based on Ubuntu:16.04.
The image is designed to be able to run applications as a nonroot user with a random user id (compatible with cloud platforms like Openshift).
Many of the features of this image have been inspired by an article series by Graham Dumpleton, specifically the following articles;
- Random user IDs when running Docker containers
- Unknown user when running Docker container
- Issues with running as PID 1 in a Docker container
How to use
The following example shows how to create an image with a self executing spring boot application. Note that you should change the ownership of the application to
application:root and allow (at least) group execute rights (to enable the application to be run as a different user than root).
Also, remember to switch back to the
application user after you have added the application and changed ownership.
FROM kodehuset/base-image-java:latest USER root ADD a-spring-boot-application.jar $HOME/bin/start.sh RUN chmod -R 775 $HOME/bin RUN chown -R application:root $HOME/bin USER application