docker-java

Design production-ready Docker container patterns for Java and Spring Boot applications.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/dprice-dev/claude-java-skills --skill docker-java
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker-java
Source: https://github.com/dprice-dev/claude-java-skills/tree/main/.claude/skills/docker-java
Command: npx skills add https://github.com/dprice-dev/claude-java-skills --skill docker-java

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Docker container decisions can cause bloated images, poor startup behavior, OOMKill failures, and insecure runtime defaults for Java and Spring Boot services.

Core Features & Use Cases

  • Layered JAR container architecture: Explains how layered copy stages and Spring Boot layertools reduce rebuild time and invalidation scope.
  • Multi-stage build guidance: Covers builder-vs-runtime separation so runtime images stay small and free of build tooling.
  • Production-ready hardening: Recommends non-root execution, health checks, read-only filesystem considerations, and pinned base image digests.
  • JVM-in-container memory tuning: Provides a safe approach using container support and MaxRAMPercentage instead of fixed -Xmx.

Quick Start

Ask the skill to recommend a Dockerfile structure for a Spring Boot 4 service that uses layered jars, runs as non-root, and sets container-aware JVM memory flags.

Frequently Asked Questions about docker-java

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I tune JVM memory for Java Docker containers to avoid OOMKills?

To avoid OOMKills in Java Docker containers, use cgroup-aware JVM flags like UseContainerSupport and MaxRAMPercentage instead of fixed -Xmx values. This allows the JVM to dynamically respect container memory limits.

What is a layered jar and how does it optimize Spring Boot Docker images?

A layered jar splits a Spring Boot application into distinct layers, allowing Docker to cache dependencies separately from application code. This reduces rebuild times and limits cache invalidation scope when updating only application classes.

How do I create a production-ready Dockerfile for Spring Boot using multi-stage builds?

Create a production-ready Spring Boot Dockerfile using multi-stage builds by separating the builder stage from the runtime stage, running as a non-root user, adding health checks, and pinning base image digests for reproducible, secure images.

Should I use a Dockerfile or Spring Boot buildpacks with bootBuildImage?

Choose a Dockerfile for granular control over layered jars, multi-stage builds, and security hardening. Choose Spring Boot buildpacks with bootBuildImage for automated, opinionated image generation without writing Dockerfile syntax.

Why is my Java application getting OOMKilled in Docker despite setting -Xmx?

Java applications get OOMKilled in Docker despite fixed -Xmx because the JVM ignores container cgroup limits by default in older versions. Use UseContainerSupport and MaxRAMPercentage to ensure the JVM respects the container memory boundaries.

How do I configure non-root execution and health checks for Java Docker containers?

Configure non-root execution in Java Docker containers by creating a dedicated user in the Dockerfile and switching to it. Add health checks using Spring Boot Actuator endpoints to ensure orchestration platforms can monitor container readiness.