-
Notifications
You must be signed in to change notification settings - Fork 473
Proposal: Add Windows version of OpenJDK #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
After finding appveyor/ci#1154 I searched for other OpenJDK distributions for Windows and found three which can be dockerized, see https://github.com/StefanScherer/dockerfiles-windows/tree/master/java/openjdk Seems that the most difficult part is which one to choose to make an official image. |
Ping @akashche FYI. I started a journey today to build OpenJDK Dockerfile for Windows today and after this PR I found your repo and another distribution from Azul. |
@StefanScherer hi, I am a maintainer of https://github.com/ojdkbuild/ojdkbuild/ OpenJDK windows builds. These builds are effectively an "unbranded" version of Red Hat Windows builds available here http://developers.redhat.com/products/openjdk/overview/ - being built from the same sources and updated at the same time. "ojdkbuild" builds of OpenJDK 8 are going to be maintained during the same period as Red Hat Windows builds will be maintained (according to this https://access.redhat.com/articles/1299013#OpenJDK_Lifecycle_Dates_and_RHEL_versions - at least until October 2020). These builds are published under GNU GPL v. 2 with classpath exception. I think it would be great, if these builds will be added to Docker Hub. Besides MSI installer (that requires admin rights) there is also a ZIP bundle download that contains the same files as MSI. I can also create an additional "lighter" version of ZIP bundle (without src.zip, jre-only etc) if it will be more convenient for Docker Hub. Please note, that "ojdkbuild" builds are NOT endorsed by upstream OpenJDK project. I can answer more questions about these builds. |
@akashche Thank you. I've prepared Dockerfiles here https://github.com/StefanScherer/dockerfiles-windows/tree/master/java/openjdk/ojdkbuild and I can update this PR to use the ojdkbuild Dockerfiles. |
Ping @arun-gupta FYI, as a Docker Captain and Java Champion, what is your opinion about such a OpenJDK/Java Windows Docker image? |
@akashche Just to understand it better. Why doesn't the OpenJDK project build a Windows version by themself? In these days it's not very much more than adding an |
@StefanScherer , it is hard to answer this question directly, so some overview about OpenJDK development process first: OpenJDK development is led by Oracle, but there is also a number of other active participants: SAP, Azul, JetBrains, Google, Twitter, Red Hat etc. Most of these companies build customized OpenJDK (for distribution or internal use) including proprietary or open-source "vendor-customizations". Red Hat OpenJDK builds are done for RHEL/CentOS/Fedora and also most Linux distributions ships OpenJDK packages built upon "RedHat-flavoured" OpenJDK sources, not directly upon upstream ones. These builds are tuned for Linux and majority of changes are about the tighter integration with OS - use OS-provided timezone data, use system libraries (zlib, jpeg-turbo etc) instead of bundled ones etc. "ojdkbuild" Windows builds were created with a goal to be as close as possible to Linux builds of OpenJDK. Answering directly, IMVHO (and of course I am not speaking for neither Oracle nor upstream OpenJDK project) Oracle holds trademarks/copyrights for OpenJDK and only Oracle can build "official" OpenJDK binaries. But Oracle already has proprietary Oracle Java builds (OpenJDK + number of proprietary customizations + some addons). And OpenJDK project doesn't have "official" binaries for any platform, not only for Windows. |
Updated the PR to build it with a single Output of the
|
@StefanScherer - coming to this late, but I've been using the Zulu OpenJDK port from Azul so far (e.g. to run Elasticsearch on Nano Server). Main reasons for choosing it:
I'm not precious though, I'll check your version out with Elasticsearch. |
Thanks @sixeyed for your experience. Well I've build all flavors of Java at https://github.com/StefanScherer/dockerfiles-windows/tree/master/java, the Oracle version made it into oracle/docker-images#209 and got merged recently. I'm open to any of the two public downloadable versions for this Docker image. |
I think Azul would probably make sense to have in a separate, Azul-dedicated image, right? (especially since they provide both Linux and Windows builds) |
Also, it sounds like these RedHat builds are probably going to be the most similar to our Linux image variants as we're going to get, so I'm generally +1 on those for this image. |
Seems like Azul offers images at https://hub.docker.com/r/azul/zulu-openjdk/ - so they should provide a Windows image ;-) |
Yes they already have a Linux image. It's not an official image though, so that balks using it as a base for other official images. +1 from me on using the RH build, I'll try it out and get back. |
@StefanScherer looks like there's a problem with Docker volumes in Windows containers in the JDK - happens with RH OpenJDK and Zulu, so it's not a distro issue. Elasticsearch uses |
@sixeyed , I reproduced this on win2016 using your symlink-test project (thanks for detailed instructions and golang reference). I'll look into this problem and return back. |
@akashche I just tried it with this simple Dockerfile FROM microsoft/windowsservercore
VOLUME c:\\data and then build a test Windows image with it
running it in interactive mode you can normally change to the directory c:\data, so it exists even it is not mounted from the docker host.
then inside the Windows container
On Linux in comparison it looks simpler and therefore the applications do not have such problems: FROM ubuntu
VOLUME /data and then
and now inside the Linux container:
|
Linking https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#fully_qualified_vs._relative_paths for reference. For a program trying to follow symlinks this could not work inside the container. The It would help a lot all that tools and languages if such volume mounts inside the container just do not show them as symlinks, just like in the Linux container example above. So following symlinks stops there and everything would be fine. I think it will be hard to explain that to all maintainers how to workaround this. Or is there a missing flag in the file attributes I just overlook? |
I once tried to propose a simple patch to stop following to that directory for Node.js, but the maintainers answered:
I hope there will be a clean way for all languages to solve that volume mount problem. |
On the volume mount problem, this is an OpenJDK bug now: JDK-8172711. For apps using volumes there is a workaround, as proposed for Elasticsearch |
@StefanScherer thanks for detailed explanation! @sixeyed on the bugreport (this openjdk upstream link may be better [1]):
Can we say, that this symlink wil be a "dangling symlink" from in-container FS point of view? I mean resolving +1 to drive letter mapping workaround. PS: as openjdk contributor I have access to its bugtracker [1] - can add comments to that issue if you would like to put some info there. |
@akashche any plans for ojdkbuild to support more than just Java 1.8, and any notes you can provide about ~how long Java 1.8 will be supported there? 😇 (this is a decent place to start for the purposes of this image, but I'm curious what the future plans will be 👍) |
Signed-off-by: Stefan Scherer <[email protected]>
…h and generate-stackbrew-library.sh
Yes, jdk9 is in preparation, and going to be added to ojdkbuild repos soon. Though public binaries for it will probably wait until upstream release in July ( http://openjdk.java.net/projects/jdk9/ ). Also jdk8 32-bit is going to be added, but that is probably not relevant to containers as nanoserver doesn't support 32-bit
Currently ojdkbuild releases on github are planned to be maintained (updated with security fixes 4 times a year) as long as jdk8 will be supported in RHEL, and, according to public info ( https://access.redhat.com/articles/1299013#OpenJDK_Lifecycle_Dates_and_RHEL_versions ), that is October 2020. Also a question about this docker image maintenance: I have an updated 8u121 release almost ready to go, what will be a preferred process to update this image with newer jdk version? Will it be convenient if I will create a pull-request to update Dockerfiles? Should I wait for this pull request to be merged first? |
For version bumps, @tianon updated the (just a reminder of the process: this would not cause new images to appear on the hub; that requires a PR to https://github.com/docker-library/official-images) |
@StefanScherer what are your thoughts on tagging these Windows variants? We're expecting a base image update from Microsoft every month. Would it be preferable to pin to a specific base image version in the Dockerfile and include that version in the tag? It would make the versions clear, but it would give us a tag like: |
@sixeyed Good question. That would be the best way to have exact version even after a new base OS update. I know that the microsoft/iis and microsoft/aspnet images use the exact OS version in the tag names which seems good to me having them there. How is it done on Linux? I had a quick look at alpine which uses alpine:3.4 and https://hub.docker.com/r/library/buildpack-deps/tags/ which seem to be updated with same tags. So I think there is no "latest is no version" restriction regarding the underlying OS image for these official images. If someone in prod has such hard constraints he/she also doesn't use any image from Docker Hub, right? So I think we should not overcomplicate things on Windows side. It would be more important for me to have current rebuilds available shortly after a base image update from Microsoft. |
@StefanScherer that makes sense, but also it seems a shame to lose that information when we have it at build time. Maybe include it as a label? I'm thinking of audit scenarios where users want to check if KBxyz is included in their build. For Ubuntu they add a timestamp as an additional tag - these are all the same image:
Just a discussion point though. |
I'm +1 to being more specific on the windows image version for the As far as tagging the image, I think anything more specific than |
Microsoft publishes a list of version numbers, and each one has a corresponding tag in References regarding Windows versions published by Microsoft: |
If you don't want to reflect the Windows version in tagging, then I think it would make sense to just use -nanoserver or -windowsservercore in the tag. microsoft/dotnet follows this approach |
Here are some Dockerfiles to build Windows docker images with OpenJDK from RedHat. These might be a starting point to get an official
openjdk:8-windowsservercore
andopenjdk:8-nanoserver
image on the Docker Hub.I first started to put Oracle Java into container images which ended in the PR oracle/docker-images#209, but everybody has to build its own version.
The idea for this variant started after I saw this image https://hub.docker.com/r/michaeltlombardi/nanoserveropenjdk/ and wondered that OpenJDK is available for Windows, too.
Yes, it is: http://developers.redhat.com/products/openjdk/overview/
So I started a Dockerfile to download the MSI package, but there is the first hard problem that the download is only available after logging in. So you have to download the MSI package on your host machine.
For the Nano Server variant I also could not use the MSI package, so the
build.sh
script copies the installed folder to the host and a nanoserver image is then created by COPYing this directory back into the image.After this worked, I thought this would also help the windowsservercore image to reduce the size of the image as I couldn't remove the MSI package after the first COPY. So the final windowsservercore image is created in the same way as the nanoserver image.
One problem might be if it is allowed to publish such image as RedHat has put that "open" OpenJDK behind a login. The agreement says something about using this only for development and not for production...