Creating simple Java 10 server container

Very often people associated Java to quite bulky and difficult to use in the microservice context, unless you have very large image containing the JRE. But since Java 9, Java did kind of catchup with golang on the subject. Where you can obtain a standalone executable when we running go build, java is now proposing jlink which always you to acheive a very similar result. The goal of this post is to build a container image as small as possible running Java.

Key Aspects

  • Use SCRATCH has base image to keep size minimum
  • Simple HelloWorld Java 10 web server
  • Create associated HELM chart for Kubernetes deployment
  • Provide deployment for both amd64 and arm32v7

Install Java 10 on dev machine

sudo add-apt-repository ppa:linuxuprising/java
 Oracle Java 10 installer

Java binaries are not hosted in this PPA due to licensing. The packages in this PPA download and install Oracle Java 10 (JDK 10), so a working Internet connection is required.

PPA for https://www.linuxuprising.com/

For feedback, see https://www.linuxuprising.com/2018/04/install-oracle-java-10-in-ubuntu-or.html
 More info: https://launchpad.net/~linuxuprising/+archive/ubuntu/java
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpf0lejdsg/secring.gpg' created
gpg: keyring `/tmp/tmpf0lejdsg/pubring.gpg' created
gpg: requesting key 73C3DB2A from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpf0lejdsg/trustdb.gpg: trustdb created
gpg: key 73C3DB2A: public key "Launchpad PPA for Linux Uprising" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
sudo apt-get update

Hit:1 http://ppa.launchpad.net/gophers/archive/ubuntu xenial InRelease
Hit:2 https://download.docker.com/linux/ubuntu xenial InRelease
Hit:3 https://deb.nodesource.com/node_10.x xenial InRelease
Get:4 http://ppa.launchpad.net/linuxuprising/java/ubuntu xenial InRelease [18.0 kB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:7 http://us.archive.ubuntu.com/ubuntu xenial InRelease
Get:8 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Hit:9 http://ppa.launchpad.net/longsleep/golang-backports/ubuntu xenial InRelease
Get:10 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [796 kB]
Hit:12 http://ppa.launchpad.net/masterminds/glide/ubuntu xenial InRelease
Get:13 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [728 kB]
Get:14 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [67.7 kB]
Get:15 http://ppa.launchpad.net/linuxuprising/java/ubuntu xenial/main amd64 Packages [1,956 B]
Get:16 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata [318 kB]
Get:17 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [72.6 kB]
Hit:5 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
Get:18 http://us.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [232 kB]
Get:19 http://ppa.launchpad.net/linuxuprising/java/ubuntu xenial/main Translation-en [1,004 B]
Get:20 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [107 kB]
Get:21 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [640 kB]
Get:22 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [142 kB]
Get:23 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [585 kB]
Get:24 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [246 kB]
Get:25 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons [338 kB]
Get:26 http://us.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [5,964 B]
Get:27 http://us.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata [3,324 B]
Get:28 http://us.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 DEP-11 Metadata [5,100 B]
Fetched 4,630 kB in 3s (1,333 kB/s)
Reading package lists... Done

Download the package and install it. Note the download speed was at time really slow. Could not figure where the source of the issue was.

sudo apt-get install oracle-java10-installer

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  gsfonts-x11 java-common oracle-java10-set-default
Suggested packages:
  binfmt-support visualvm ttf-baekmuk | ttf-unfonts | ttf-unfonts-core ttf-kochi-gothic | ttf-sazanami-gothic ttf-kochi-mincho | ttf-sazanami-mincho ttf-arphic-uming
The following NEW packages will be installed:
  gsfonts-x11 java-common oracle-java10-installer oracle-java10-set-default
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 46.6 kB of archives.
After this operation, 265 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 java-common all 0.56ubuntu2 [7,742 B]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 gsfonts-x11 all 0.24 [7,314 B]
Get:3 http://ppa.launchpad.net/linuxuprising/java/ubuntu xenial/main amd64 oracle-java10-installer amd64 10.0.1-1~linuxuprising+1 [29.0 kB]
Get:4 http://ppa.launchpad.net/linuxuprising/java/ubuntu xenial/main amd64 oracle-java10-set-default amd64 10.0.1-1~linuxuprising+1 [2,464 B]
Fetched 46.6 kB in 0s (55.0 kB/s)
Preconfiguring packages ...
Selecting previously unselected package java-common.
(Reading database ... 239646 files and directories currently installed.)
Preparing to unpack .../java-common_0.56ubuntu2_all.deb ...
Unpacking java-common (0.56ubuntu2) ...
Selecting previously unselected package oracle-java10-installer.
Preparing to unpack .../oracle-java10-installer_10.0.1-1~linuxuprising+1_amd64.deb ...
Unpacking oracle-java10-installer (10.0.1-1~linuxuprising+1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ...
Setting up java-common (0.56ubuntu2) ...
Setting up oracle-java10-installer (10.0.1-1~linuxuprising+1) ...
No /var/cache/oracle-jdk10-installer/wgetrc file found.
Creating /var/cache/oracle-jdk10-installer/wgetrc and
using default oracle-java10-installer wgetrc settings for it.
Downloading Oracle Java 10...
--2018-07-01 11:04:19--  http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz
Resolving download.oracle.com (download.oracle.com)... 23.45.132.164
Connecting to download.oracle.com (download.oracle.com)|23.45.132.164|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz [following]
--2018-07-01 11:04:19--  https://edelivery.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.72.169.50
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.72.169.50|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz?AuthParam=1530461180_a5ea3c7d2dd9864c93b5a0d9d202ba07 [following]
--2018-07-01 11:04:20--  http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz?AuthParam=1530461180_a5ea3c7d2dd9864c93b5a0d9d202ba07
Connecting to download.oracle.com (download.oracle.com)|23.45.132.164|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 354846158 (338M) [application/x-gzip]
Saving to: ‘jdk-10.0.1_linux-x64_bin.tar.gz’

     0K ........ ........ ........ ........ ........ ........  0%  169K 33m55s
  3072K ........ ........ ........ ........ ........ ........  1%  131K 38m29s
  6144K ........ ........ ........ ........ ........ ........  2% 28.2K 91m46s
  9216K ........ ........ ........ ........ ........ ........  3%  263K 73m30s
 12288K ........ ........ ........ ........ ........ ........  4%  142K 66m2s
 15360K ........ ........ ........ ........ ........ ........  5% 2.31M 54m54s
 18432K ........ ........ ........ ........ ........ ........  6% 2.06M 46m59s
 21504K ........ ........ ........ ........ ........ ........  7% 1.26M 41m15s
 24576K ........ ........ ........ ........ ........ ........  7% 1.71M 36m39s
 27648K ........ ........ ........ ........ ........ ........  8% 1.35M 33m3s
 30720K ........ ........ ........ ........ ........ ........  9% 1.73M 30m1s
 33792K ........ ........ ........ ........ ........ ........ 10% 2.27M 27m26s
 36864K ........ ........ ........ ........ ........ ........ 11% 1.61M 25m19s
 39936K ........ ........ ........ ........ ........ ........ 12% 2.42M 23m25s
 43008K ........ ........ ........ ........ ........ ........ 13% 1.50M 21m51s
 46080K ........ ........ ........ ........ ........ ........ 14% 2.26M 20m24s
 49152K ........ ........ ........ ........ ........ ........ 15% 2.33M 19m8s
 52224K ........ ........ ........ ........ ........ ........ 15% 2.21M 18m0s
 55296K ........ ........ ........ ........ ........ ........ 16% 1.58M 17m2s
 58368K ........ ........ ........ ........ ........ ........ 17% 1.84M 16m8s
 61440K ........ ........ ........ ........ ........ ........ 18% 1.61M 15m20s
 64512K ........ ........ ........ ........ ........ ........ 19% 3.04M 14m33s
 67584K ........ ........ ........ ........ ........ ........ 20% 2.91M 13m49s
 70656K ........ ........ ........ ........ ........ ........ 21% 3.17M 13m9s
 73728K ........ ........ ........ ........ ........ ........ 22% 1.36M 12m37s
 76800K ........ ........ ........ ........ ........ ........ 23% 1.75M 12m5s
 79872K ........ ........ ........ ........ ........ ........ 23% 2.08M 11m35s
 82944K ........ ........ ........ ........ ........ ........ 24% 2.50M 11m6s
 86016K ........ ........ ........ ........ ........ ........ 25% 1.78M 10m40s
 89088K ........ ........ ........ ........ ........ ........ 26% 2.14M 10m16s
 92160K ........ ........ ........ ........ ........ ........ 27% 1.56M 9m54s
 95232K ........ ........ ........ ........ ........ ........ 28% 2.20M 9m31s
 98304K ........ ........ ........ ........ ........ ........ 29% 1.98M 9m11s
101376K ........ ........ ........ ........ ........ ........ 30% 2.28M 8m51s
104448K ........ ........ ........ ........ ........ ........ 31% 2.91M 8m32s
107520K ........ ........ ........ ........ ........ ........ 31% 2.12M 8m14s
110592K ........ ........ ........ ........ ........ ........ 32% 1.76M 7m58s
113664K ........ ........ ........ ........ ........ ........ 33% 2.02M 7m42s
116736K ........ ........ ........ ........ ........ ........ 34% 1.21M 7m29s
119808K ........ ........ ........ ........ ........ ........ 35% 1.12M 7m17s
122880K ........ ........ ........ ........ ........ ........ 36% 1.18M 7m5s
125952K ........ ........ ........ ........ ........ ........ 37% 70.0K 8m3s
129024K ........ ........ ........ ........ ........ ........ 38% 1.40M 7m48s
132096K ........ ........ ........ ........ ........ ........ 39% 84.1K 8m28s
135168K ........ ........ ........ ........ ........ ........ 39%  804K 8m15s
138240K ........ ........ ........ ........ ........ ........ 40% 2.67M 7m59s
141312K ........ ........ ........ ........ ........ ........ 41% 2.88M 7m43s
144384K ........ ........ ........ ........ ........ ........ 42% 2.77M 7m28s
147456K ........ ........ ........ ........ ........ ........ 43% 1.88M 7m14s
150528K ........ ........ ........ ........ ........ ........ 44% 2.53M 7m1s
153600K ........ ........ ........ ........ ........ ........ 45% 2.48M 6m47s
156672K ........ ........ ........ ........ ........ ........ 46% 4.11M 6m34s
159744K ........ ........ ........ ........ ........ ........ 46% 3.75M 6m21s
162816K ........ ........ ........ ........ ........ ........ 47% 4.39M 6m8s
165888K ........ ........ ........ ........ ........ ........ 48% 3.77M 5m56s
168960K ........ ........ ........ ........ ........ ........ 49% 4.56M 5m45s
172032K ........ ........ ........ ........ ........ ........ 50% 3.32M 5m33s
175104K ........ ........ ........ ........ ........ ........ 51% 2.91M 5m23s
178176K ........ ........ ........ ........ ........ ........ 52% 2.38M 5m13s
181248K ........ ........ ........ ........ ........ ........ 53% 3.56M 5m3s
184320K ........ ........ ........ ........ ........ ........ 54% 3.06M 4m53s
187392K ........ ........ ........ ........ ........ ........ 54% 2.72M 4m43s
190464K ........ ........ ........ ........ ........ ........ 55% 2.38M 4m34s
193536K ........ ........ ........ ........ ........ ........ 56% 3.57M 4m25s
196608K ........ ........ ........ ........ ........ ........ 57% 3.46M 4m17s
199680K ........ ........ ........ ........ ........ ........ 58% 3.41M 4m8s
202752K ........ ........ ........ ........ ........ ........ 59% 2.67M 4m0s
205824K ........ ........ ........ ........ ........ ........ 60% 2.92M 3m52s
208896K ........ ........ ........ ........ ........ ........ 61% 2.62M 3m44s
211968K ........ ........ ........ ........ ........ ........ 62% 2.77M 3m37s
215040K ........ ........ ........ ........ ........ ........ 62% 2.68M 3m29s
218112K ........ ........ ........ ........ ........ ........ 63% 3.41M 3m22s
221184K ........ ........ ........ ........ ........ ........ 64% 2.99M 3m15s
224256K ........ ........ ........ ........ ........ ........ 65% 3.98M 3m8s
227328K ........ ........ ........ ........ ........ ........ 66% 3.04M 3m1s
230400K ........ ........ ........ ........ ........ ........ 67% 3.69M 2m54s
233472K ........ ........ ........ ........ ........ ........ 68% 2.00M 2m48s
236544K ........ ........ ........ ........ ........ ........ 69% 2.92M 2m42s
239616K ........ ........ ........ ........ ........ ........ 70% 2.35M 2m36s
242688K ........ ........ ........ ........ ........ ........ 70% 2.55M 2m30s
245760K ........ ........ ........ ........ ........ ........ 71% 2.74M 2m24s
248832K ........ ........ ........ ........ ........ ........ 72% 3.33M 2m18s
251904K ........ ........ ........ ........ ........ ........ 73% 3.94M 2m12s
254976K ........ ........ ........ ........ ........ ........ 74% 2.82M 2m6s
258048K ........ ........ ........ ........ ........ ........ 75% 2.62M 2m1s
261120K ........ ........ ........ ........ ........ ........ 76% 2.76M 1m56s
264192K ........ ........ ........ ........ ........ ........ 77% 3.01M 1m50s
267264K ........ ........ ........ ........ ........ ........ 78% 2.75M 1m45s
270336K ........ ........ ........ ........ ........ ........ 78% 3.23M 1m40s
273408K ........ ........ ........ ........ ........ ........ 79% 3.05M 95s
276480K ........ ........ ........ ........ ........ ........ 80% 3.66M 90s
279552K ........ ........ ........ ........ ........ ........ 81% 2.99M 85s
282624K ........ ........ ........ ........ ........ ........ 82% 2.43M 80s
285696K ........ ........ ........ ........ ........ ........ 83% 2.48M 76s
288768K ........ ........ ........ ........ ........ ........ 84% 2.71M 71s
291840K ........ ........ ........ ........ ........ ........ 85% 2.44M 67s
294912K ........ ........ ........ ........ ........ ........ 85% 2.95M 62s
297984K ........ ........ ........ ........ ........ ........ 86% 2.66M 58s
301056K ........ ........ ........ ........ ........ ........ 87% 2.43M 54s
304128K ........ ........ ........ ........ ........ ........ 88% 2.92M 49s
307200K ........ ........ ........ ........ ........ ........ 89% 2.59M 45s
310272K ........ ........ ........ ........ ........ ........ 90% 3.23M 41s
313344K ........ ........ ........ ........ ........ ........ 91% 2.75M 37s
316416K ........ ........ ........ ........ ........ ........ 92% 3.07M 33s
319488K ........ ........ ........ ........ ........ ........ 93% 2.51M 29s
322560K ........ ........ ........ ........ ........ ........ 93% 2.80M 25s
325632K ........ ........ ........ ........ ........ ........ 94% 2.11M 21s
328704K ........ ........ ........ ........ ........ ........ 95% 2.87M 18s
331776K ........ ........ ........ ........ ........ ........ 96% 2.51M 14s
334848K ........ ........ ........ ........ ........ ........ 97% 2.77M 10s
337920K ........ ........ ........ ........ ........ ........ 98% 3.05M 6s
340992K ........ ........ ........ ........ ........ ........ 99% 3.22M 3s
344064K ........ ........ ........ ........ ......           100% 2.89M=6m40s

2018-07-01 11:11:00 (867 KB/s) - ‘jdk-10.0.1_linux-x64_bin.tar.gz’ saved [354846158/354846158]

Download done.
Removing outdated cached downloads...
update-alternatives: error: no alternatives for java
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jaotc to provide /usr/bin/jaotc (jaotc) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jar to provide /usr/bin/jar (jar) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/javac to provide /usr/bin/javac (javac) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/javap to provide /usr/bin/javap (javap) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/javapackager to provide /usr/bin/javapackager (javapackager) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jcontrol to provide /usr/bin/jcontrol (jcontrol) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jdeprscan to provide /usr/bin/jdeprscan (jdeprscan) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jdeps to provide /usr/bin/jdeps (jdeps) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jhsdb to provide /usr/bin/jhsdb (jhsdb) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jimage to provide /usr/bin/jimage (jimage) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jjs to provide /usr/bin/jjs (jjs) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jlink to provide /usr/bin/jlink (jlink) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jmc to provide /usr/bin/jmc (jmc) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jmod to provide /usr/bin/jmod (jmod) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jps to provide /usr/bin/jps (jps) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jshell to provide /usr/bin/jshell (jshell) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/jweblauncher to provide /usr/bin/jweblauncher (jweblauncher) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
update-alternatives: using /usr/lib/jvm/java-10-oracle/bin/javaws.real to provide /usr/bin/javaws.real (javaws.real) in auto mode
Oracle JDK 10 installed

#####Important########
To set Oracle jdk10 as default, install the "oracle-java10-set-default" package.
E.g.: sudo apt install oracle-java10-set-default.
Selecting previously unselected package oracle-java10-set-default.
(Reading database ... 239682 files and directories currently installed.)
Preparing to unpack .../oracle-java10-set-default_10.0.1-1~linuxuprising+1_amd64.deb ...
Unpacking oracle-java10-set-default (10.0.1-1~linuxuprising+1) ...
Selecting previously unselected package gsfonts-x11.
Preparing to unpack .../gsfonts-x11_0.24_all.deb ...
Unpacking gsfonts-x11 (0.24) ...
Processing triggers for fontconfig (2.11.94-0ubuntu1.1) ...
Setting up oracle-java10-set-default (10.0.1-1~linuxuprising+1) ...
Setting up gsfonts-x11 (0.24) ...
sudo apt-get install oracle-java10-set-default

Reading package lists... Done
Building dependency tree
Reading state information... Done
oracle-java10-set-default is already the newest version (10.0.1-1~linuxuprising+1).
oracle-java10-set-default set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
java --version
java 10.0.1 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
javac --version

javac 10.0.1

Create a micro service on the host

Details on how to use the new java 10 to create the service are given in the following repo