Base image for Java services, Java 8.
Create a Dockerfile in your Java service.
FROM yti-docker-java-base:latest
# replace this with your application's default port
EXPOSE 9000
You can then build and run the Docker image:
$ docker build -t my-java-service .
$ docker run -it --rm --name my-running-app my-java-service
The yti-docker-java-base images come in many flavors, each designed for a specific use case.
This image uses Oracle Java 8 JDK and is based on Ubuntu.
This image uses OpenJDK and is based on Debian. If you are unsure about what your needs are, you probably want to use this one.
This tag is based off of official openjdk docker repository, Dockerfile.
This image uses OpenJDK and is based on the Alpine Linux project.
This tag is based off of official openjdk docker repository, Dockerfile.
Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements.
With Alpine Linux
build.sh alpine <tag>
or
docker build -t yti-docker-java-base -f `pwd`/alpine/Dockerfile .
With Debian based system
build.sh debian <tag>
or
docker build -t yti-docker-java-base -f `pwd`/debian/Dockerfile .
With Ubuntu Linux
build.sh ubuntu <tag>
or
docker build -t yti-docker-java-base -f `pwd`/ubuntu/Dockerfile .
docker run --name yti-docker-java-base -ti --rm yti-docker-java-base /bin/sh
docker exec -it yti-docker-java-base /bin/sh