

For those situations it can be helpful to strip an image of all its layers and flatten it. Many times the extra layers in your base images will not be re-used. It’s a mental thing more than anything so excuse my weirdness if you can. I love the layering ability of Docker images but for base images upon which I’ll build my stacks often I’d like them to consist of a single layer. RUN mkdir /opt & curl -jksSLH "Cookie: oraclelicense=accept-securebackup-cookie"
#THE UNARCHIVER 3.11.1 ZIP APK#
RUN apk -update add curl ca-certificates tar &Īpk add -allow-untrusted /tmp/ # AlpineLinux with a glibc-2.21 and Oracle Java 8 The whole process is well laid out amongst others in a clean Dockerfile by anapsix which I list here for completeness:
#THE UNARCHIVER 3.11.1 ZIP INSTALL#
Install glibc-2.21 which is a hard dependency of Java 8.Install curl, tar, and ca-certificates on the base alpine image.Do you want to see how that’s done? This is the list of steps: In this case we can’t use Alpine package manager (yet), we have to wrangle the installation ourselves from the official Oracle packages. NICE! What about Oracle JRE/JDK 8?įor many applications teams prefer or require the Oracle JDK. The result is a Java 7 runtime environment, ready for your Java 7 applications in only 123MB instead than 800+MB. OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode) Now you can test that java is installed with:.

If you are still using JDK7 and you don’t have a strong requirement to have the Oracle version, the easiest and leaner image I found is very simple to setup with this Dockerfile: The objective: to have a minimal Java container for my (and your) applications. Let’s dream together. And the base image is … 5Mb ?! Where have I been hiding? Why didn’t I know about this?! Anyway here’s my chance to make things right. A colleague of mine few days ago mentioned Alpine Linux, a minimalistic Linux distribution based on musl libc and BusyBox that comes with a nice package manager. Official Java images have historically been mastodontic – cue picture above – I just tried “ docker pull java” and I got an image of 816.4MB. A minimal Java container has been on my wish list since I found out about Docker and I’ve been writing about running Java in Docker for sometime already. Sometimes I need to be hit in the head with an axe to find a solution to a problem that has been bugging me forever.
