Installing Java into WIndows Nano

I’m attempting to shrink some windows containers by moving from core to nano, but I’m having issues installing Java into a nano container. Has anyone pulled this off?

running the jre installer simply silently exists with no work being done. however, the same command in servercore works perfectly. From my buildprofile:

RUN powershell start-process -filepath C:\install\jre.exe -passthru -wait -argumentlist "/s,INSTALLDIR=c:\java,/L,install64.log"

again, awesome in core, no fly zone in nano (command is slightly different as there’s no powershell, but still). So I went with a multi-stage build where I installed java onto server core then copied the folder (in this case C:\java) into nano and set the environment variables. This appears to work … but the various war files don’t all run successfully. example, with the jenkins war …

  1. the first-time login wizard starts (good!), but it doesn’t think it’s online so I can’t download starting packages.
  2. when the wizard is finished the screen blanks and it never goes to the home page.

I figure step 1 in torubleshooting this is to ensure java is installed and healthy on nano … but I’ve not figured out how to pull that off yet.

Anyone know of a DockerFile that does this? Optionally, anyone know an easy way to test java to ensure it’s healthy?

1 Like

I have the same problem, can anyone solve it? HELP.

I am having the same difficulty–I think it is because Nano Server does not contain the Windows Installer (msiexec.exe), unlike servercore.

I found this docker file which seems to do it by using a docker builder image to first install Java in servercore, then copying the install into a nano server image. I haven’t tried it yet, myself.

https://github.com/StefanScherer/dockerfiles-windows/blob/master/java/openjdk/ojdkbuild/nanoserver/Dockerfile