wiremock / wiremock/wiremock-docker

Container memory limit is not respected

Open Beginner friendly
#146 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
240
Forks
108
PR merge metrics
No merged PRs in 30d

Description

Proposal

Hello!

When I'm running wiremock inside a docker container with hard memory limit, java doesn't detect it and wants to use 25% of available host memory by default. This is an issue of Temurin-17.0.19+10, and it is not present in Temurin-17.0.20+8:

$ docker run -it --rm -m 512m eclipse-temurin:17-jre java -XshowSettings:vm -version
VM settings:
    Max. Heap Size (Estimated): 123.75M
    Using VM: OpenJDK 64-Bit Server VM

openjdk version "17.0.20" 2026-07-21
OpenJDK Runtime Environment Temurin-17.0.20+8 (build 17.0.20+8)
OpenJDK 64-Bit Server VM Temurin-17.0.20+8 (build 17.0.20+8, mixed mode, sharing)

I believe simple rebuild of docker image should pull a newer Temurin java version and the problem will be solved.

Reproduction steps

Here is how I am launching a Docker container with 512MB memory limit. Java reports max heap size of 15+GB

$ docker run -it --rm --entrypoint java -m 512m wiremock/wiremock:latest -XshowSettings:vm -version
VM settings:
    Max. Heap Size (Estimated): 15.67G
    Using VM: OpenJDK 64-Bit Server VM

openjdk version "17.0.19" 2026-04-21
OpenJDK Runtime Environment Temurin-17.0.19+10 (build 17.0.19+10)
OpenJDK 64-Bit Server VM Temurin-17.0.19+10 (build 17.0.19+10, mixed mode, sharing)
References

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the repository's Docker image build definition and identify where the Temurin base-image version is selected. Reproduce the reported command with a 512 MB limit, update the image to a version that resolves the issue, and rerun the command to confirm Java detects the container limit.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
devops, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.