Lightweight Docker Images for Java Apps
If you're searching for a way to get your Docker images down to a more manageable size, it might just be easier to choose a different starting point.
Join the DZone community and get the full member experience.
Join For FreeThere are a number of posts (e.g. here) talking about the official Java Docker images being on the large side – in Docker terms. The standard images can be more than 600MB before you even build the image containing your app. That's… pretty big.
Suggestions are to use a smaller image as a starting point, like Alpine Linux. It looks like at some point the official Java images have been updated to include a number of Alpine based images, too.
Pulling down an OpenJDK 8 image, java:openjdk-8-jdk and then java:openjdk-8-alpine, there's a massive size difference between the size of the two:
If you're planning on running something lightweight like a Spring Boot app, it looks like the provided Alpine images are a good starting point.
Opinions expressed by DZone contributors are their own.
Comments