Skip to content

Commit fb6cbc6

Browse files
committed
Clarify use of ES_JAVA_OPTS and Docker
Closes elastic#51626. Tweak the documentation around configuring the heap size when using Docker, to state that: - using `ES_JAVA_OPTS` is the preferred method - Any `ES_JAVA_OPTS` overrides the defaults in `jvm.options` - It's possible to bind-mount a custom `jvm.options`
1 parent c21837f commit fb6cbc6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

docs/reference/setup/install/docker.asciidoc

+11-1
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,25 @@ TCP ports 9200 and 9300. For production clusters, randomizing the
263263
published ports with `--publish-all` is recommended,
264264
unless you are pinning one container per host.
265265

266+
[[docker-set-heap-size]]
266267
===== Set the heap size
267268

268269
Use the `ES_JAVA_OPTS` environment variable to set the heap size.
269-
For example, to use 16GB, specify `-e ES_JAVA_OPTS="-Xms16g -Xmx16g"` with `docker run`.
270+
For example, to use 16GB, specify `-e ES_JAVA_OPTS="-Xms16g -Xmx16g"` with
271+
`docker run`. Note that while the default configuration file `jvm.options`
272+
sets a default heap of 1GB, any value you set in `ES_JAVA_OPTS` will
273+
override it.
270274

271275
IMPORTANT: You must <<heap-size,configure the heap size>> even if you are
272276
https://docs.docker.com/config/containers/resource_constraints/#limit-a-containers-access-to-memory[limiting
273277
memory access] to the container.
274278

279+
While setting the heap size via an environment variable is the recommended
280+
method, you can also configure this by bind-mounting your own `jvm.options`
281+
file under `/usr/share/elasticsearch/config/`. The file that {es} provides
282+
contains some important settings, so you should start by taking a copy of
283+
`jvm.options` from an {es} container and editing it as you require.
284+
275285
===== Pin deployments to a specific image version
276286

277287
Pin your deployments to a specific version of the {es} Docker image. For

docs/reference/setup/jvm-options.asciidoc

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ file is `config/jvm.options` (when installing from the tar or zip distributions)
1111
and `/etc/elasticsearch/jvm.options` (when installing from the Debian or RPM
1212
packages).
1313

14+
NOTE: If you are using the <<docker,Docker distribution of {es}>>, we
15+
recommend that you <<docker-set-heap-size,set the heap size using the
16+
`ES_JAVA_OPTS` environment variable>>.
17+
1418
This file contains a line-delimited list of JVM arguments following
1519
a special syntax:
1620

0 commit comments

Comments
 (0)