Skip to content

Allow setting the driver memory of the Docker image - #262

Merged
jnioche merged 1 commit into
mainfrom
docker-driver-memory
Aug 20, 2026
Merged

Allow setting the driver memory of the Docker image#262
jnioche merged 1 commit into
mainfrom
docker-driver-memory

Conversation

@jnioche

@jnioche jnioche commented Aug 20, 2026

Copy link
Copy Markdown
Member

The Docker entrypoint hardcodes --driver-memory 4g, and there is no way to raise it from the docker run command line:

  • SPARK_DRIVER_MEMORY loses to the explicit --driver-memory flag;
  • SPARK_SUBMIT_OPTS=-Xmx16g is emitted before the -Xmx4g derived from --driver-memory, so the JVM takes the 4g;
  • spark.driver.extraJavaOptions rejects -Xmx outright.

The only workaround was --entrypoint /opt/spark/bin/spark-submit plus the full spark-submit command.

The driver memory is now read from SPRUCE_DRIVER_MEMORY, defaulting to 4g so existing invocations are unchanged:

docker run --rm -v $(pwd):/workspace -w /workspace \
-e SPRUCE_DRIVER_MEMORY=16g \
ghcr.io/digitalpebble/spruce \
-i curs -o output

Verified with SPARK_PRINT_LAUNCH_COMMAND=1 on an image built from this branch: no variable gives -Xmx4g, SPRUCE_DRIVER_MEMORY=9g gives -Xmx9g.

Documentation: a new Allocating more memory section in the Docker tutorial, including the caveats that the container must actually be allowed that much memory and that report/dashboard ignore the variable.

Also fixes the Docker example in the S3 how-to, which still passed a whole spark-submit invocation as arguments — since the entrypoint was introduced those are passed to the SPRUCE job instead, so the example could not work as written.

The entrypoint hardcoded --driver-memory 4g, which could not be overridden
from the command line: SPARK_SUBMIT_OPTS=-Xmx.. is emitted before the -Xmx
derived from --driver-memory and so loses, and spark.driver.extraJavaOptions
rejects -Xmx outright. The only way was to bypass the entrypoint entirely.

The driver memory now comes from SPRUCE_DRIVER_MEMORY, defaulting to 4g as
before, and is documented in the Docker tutorial.

Also updates the S3 how-to, whose Docker example still passed a full
spark-submit command as arguments; those have been arguments of the SPRUCE
job itself since the entrypoint was introduced.
@jnioche jnioche added this to the 1.3 milestone Aug 20, 2026
@jnioche jnioche added docker Pull requests that update docker code enhancement New feature or request labels Aug 20, 2026
@jnioche
jnioche merged commit dc3da21 into main Aug 20, 2026
3 checks passed
@jnioche
jnioche deleted the docker-driver-memory branch August 20, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Pull requests that update docker code enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant