Skip to content

VRK-YTI/yti-docker-java-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yti-docker-java-base

Base image for Java services, Java 8.

Usage

How to use this image

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

Image Variants

The yti-docker-java-base images come in many flavors, each designed for a specific use case.

yti--docker-java-base:latest

This image uses Oracle Java 8 JDK and is based on Ubuntu.

yti-docker-java-base:debian

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.

yti-docker-java-base:alpine

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.

Build

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 .

Run

docker run --name yti-docker-java-base -ti --rm yti-docker-java-base /bin/sh

Inspecting running image

docker exec -it yti-docker-java-base /bin/sh