Over a million developers have joined DZone.

Lightweight Docker Images for Java Apps

DZone's Guide to

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.

· Cloud Zone ·
Free Resource

Discover a centralized approach to monitor your virtual infrastructure, on-premise IT environment, and cloud infrastructure – all on a single platform.

There 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.

Learn how to auto-discover your containers and monitor their performance, capture Docker host and container metrics to allocate host resources, and provision containers.

docker images ,alpine linux

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}