Memory allocation behaviour -- run vs create

Expected behavior

run -m4g myimage and create -m4g myimage would both run myimage in a container with 4g of available memory

Actual behavior

create appears to allocate memory, run does not. My use case is a Spring Boot-based Java app, where I’m setting the heap size as part of the ENTRYPOINT property

e.g.

ENTRYPOINT [“java”,“-Xmx1g -Djava.security.egd=file:/dev/./urandom”,“-jar”,“/app.jar”]

With the create option, this works – with run I get an Invalid Heap Size error, indicating Java can’t pre-allocate 1g for its heap.

Information

Full Dockerfile is basically this:

FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD xxxxx-0.0.2-RELEASE.jar app.jar
EXPOSE 8080
RUN sh -c ‘touch /app.jar’
ENTRYPOINT [“java”,“-Xmx1g -Djava.security.egd=file:/dev/./urandom”,“-jar”,“/app.jar”]

  • the output of:
    • Moby Menu > Diagnose & Feedback on OSX
  • a reproducible case if this is a bug, Dockerfiles FTW
  • page URL if this is a docs issue or the name of a man page
  • host distribution and version ( OSX 10.10.x, OSX 10.11.x, Windows, etc )

Steps to reproduce the behavior