Skip to content

Commit 12e5fcb

Browse files
authored
[8.9] [DOCS] Simplify single-node Docker instructions (#98886) (#98937)
1 parent bef0068 commit 12e5fcb

File tree

1 file changed

+63
-85
lines changed

1 file changed

+63
-85
lines changed

docs/reference/setup/install/docker.asciidoc

Lines changed: 63 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[[docker]]
22
=== Install {es} with Docker
33

4-
{es} is also available as Docker images. A list of all published Docker
5-
images and tags is available at
6-
https://www.docker.elastic.co[www.docker.elastic.co]. The source files are
7-
in
4+
{es} is available as a Docker image. A list of all published Docker images and
5+
tags is available at https://www.docker.elastic.co[www.docker.elastic.co]. The
6+
source files are in
87
https://github.com/elastic/elasticsearch/blob/{branch}/distribution/docker[Github].
98

109
include::license.asciidoc[]
@@ -13,19 +12,19 @@ Starting in {es} 8.0, security is enabled by default. With security enabled,
1312
{stack} {security-features} require TLS encryption for the transport networking
1413
layer, or your cluster will fail to start.
1514

16-
==== Install Docker Desktop or Docker Engine
15+
==== Install Docker
1716

18-
Install the appropriate https://docs.docker.com/get-docker/[Docker application]
19-
for your operating system.
17+
Visit https://docs.docker.com/get-docker/[Get Docker] to install Docker for your
18+
environment.
2019

21-
NOTE: Make sure that Docker is allotted at least 4GiB of memory. In Docker
22-
Desktop, you configure resource usage on the Advanced tab in Preference (macOS)
23-
or Settings (Windows).
20+
IMPORTANT: If using Docker Desktop, make sure to allocate at least 4GB of
21+
memory. You can adjust memory usage in Docker Desktop by going to **Settings >
22+
Resources**.
2423

25-
==== Pull the {es} Docker image
24+
==== Pull the Docker image
2625

27-
Obtaining {es} for Docker is as simple as issuing a `docker pull` command
28-
against the Elastic Docker registry.
26+
Use the `docker pull` command to pull the {es} image from the the Elastic Docker
27+
registry.
2928

3029
ifeval::["{release-state}"=="unreleased"]
3130

@@ -44,12 +43,11 @@ docker pull {docker-repo}:{version}
4443
endif::[]
4544

4645
[[docker-verify-signature]]
47-
==== Optional: Verify the {es} Docker image signature
46+
==== Optional: Verify the image signature
4847

49-
Although it's optional, we highly recommend verifying the signatures included with your downloaded Docker images to ensure that the images are valid.
48+
Verify the signatures included in your {es} Docker images to ensure they're valid.
5049

5150
Elastic images are signed with https://docs.sigstore.dev/cosign/overview/[Cosign] which is part of the https://www.sigstore.dev/[Sigstore] project.
52-
5351
Cosign supports container signing, verification, and storage in an OCI registry.
5452

5553
ifeval::["{release-state}"=="unreleased"]
@@ -76,7 +74,7 @@ cosign verify --key cosign.pub {docker-repo}:{version} <2>
7674

7775
The command prints the check results and the signature payload in JSON format:
7876

79-
[source,sh]
77+
[source,sh,subs="attributes"]
8078
--------------------------------------------
8179
Verification for docker.elastic.co/elasticsearch/elasticsearch:{version} --
8280
The following checks were performed on each of these signatures:
@@ -87,47 +85,35 @@ The following checks were performed on each of these signatures:
8785

8886
endif::[]
8987

90-
Now that you have verified the {es} Docker image signature, you can start a
91-
<<docker-cli-run-dev-mode,single-node>> or <<docker-compose-file,multi-node>>
92-
cluster.
9388

9489
[[docker-cli-run-dev-mode]]
95-
==== Start a single-node cluster with Docker
90+
==== Run {es} in Docker
9691

97-
ifeval::["{release-state}"=="unreleased"]
92+
Use Docker commands to start a single-node {es} cluster for development or
93+
testing. You can then run additional Docker commands to add nodes to the test
94+
cluster.
9895

99-
WARNING: Version {version} of the {es} Docker image has not yet been released.
96+
TIP: This setup doesn't run multiple {es} nodes or {kib} by default. To create a
97+
multi-node cluster with {kib}, use Docker Compose instead. See
98+
<<docker-compose-file>>.
10099

101-
endif::[]
102100

103-
If you're starting a single-node {es} cluster in a Docker container, security
104-
will be automatically enabled and configured for you. When you start {es} for
105-
the first time, the following security configuration occurs automatically:
101+
===== Start a single-node cluster
106102

107-
* <<elasticsearch-security-certificates,Certificates and keys>> are generated
108-
for the transport and HTTP layers.
109-
* The Transport Layer Security (TLS) configuration settings are written to
110-
`elasticsearch.yml`.
111-
* A password is generated for the `elastic` user.
112-
* An enrollment token is generated for {kib}.
103+
ifeval::["{release-state}"=="unreleased"]
113104

114-
You can then {kibana-ref}/docker.html[start {kib}] and enter the enrollment
115-
token, which is valid for 30 minutes. This token automatically applies the
116-
security settings from your {es} cluster, authenticates to {es} with the
117-
`kibana_system` user, and writes the security configuration to `kibana.yml`.
105+
WARNING: Version {version} of the {es} Docker image has not yet been released.
118106

119-
The following commands start a single-node {es} cluster for development or
120-
testing.
107+
endif::[]
121108

122-
. Create a new docker network for {es} and {kib}
109+
. Create a new docker network.
123110
+
124111
[source,sh]
125112
----
126113
docker network create elastic
127114
----
128115

129-
. Start {es} in Docker. A password is generated for the `elastic` user and
130-
output to the terminal, plus an enrollment token for enrolling {kib}.
116+
. Start an {es} container.
131117
+
132118
--
133119
ifeval::["{release-state}"=="unreleased"]
@@ -140,78 +126,64 @@ endif::[]
140126
ifeval::["{release-state}"!="unreleased"]
141127
[source,sh,subs="attributes"]
142128
----
143-
docker run --name es01 --net elastic -p 9200:9200 -it {docker-image}
129+
docker run --name es01 --net elastic -p 9200:9200 -it -m 1GB {docker-image}
144130
----
145131

132+
TIP: Use the `-m` flag to set a memory limit for the container.
133+
134+
The command prints the `elastic` user password and an enrollment token for {kib}.
135+
146136
endif::[]
147137
--
148-
+
149-
TIP: You might need to scroll back a bit in the terminal to view the password
150-
and enrollment token.
151138

152-
. Copy the generated password and enrollment token and save them in a secure
153-
location. These values are shown only when you start {es} for the first time.
139+
. Copy the generated `elastic` password and enrollment token. These credentials
140+
are only shown when you start {es} for the first time. You can regenerate the
141+
credentials using the following commands.
154142
+
155-
[NOTE]
156-
====
157-
If you need to reset the password for the `elastic` user or other
158-
built-in users, run the <<reset-password,`elasticsearch-reset-password`>> tool.
159-
This tool is available in the {es} `/bin` directory of the Docker container.
160-
For example:
143+
--
144+
[source,sh,subs="attributes"]
145+
----
146+
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password
147+
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
148+
----
149+
150+
We recommend storing the `elastic` password as an environment variable in your shell. Example:
161151

162152
[source,sh]
163153
----
164-
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password
154+
export ELASTIC_PASSWORD="your_password"
165155
----
166-
====
156+
--
167157

168-
. Copy the `http_ca.crt` security certificate from your Docker container to
169-
your local machine.
158+
. Copy the `http_ca.crt` SSL certificate from the container to your local machine.
170159
+
171160
[source,sh]
172161
----
173162
docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
174163
----
175164

176-
. Open a new terminal and verify that you can connect to your {es} cluster by
177-
making an authenticated call, using the `http_ca.crt` file that you copied from
178-
your Docker container. Enter the password for the `elastic` user when prompted.
165+
. Make a REST API call to {es} to ensure the {es} container is running.
179166
+
180167
[source,sh]
181168
----
182-
curl --cacert http_ca.crt -u elastic https://localhost:9200
169+
curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200
183170
----
184171
// NOTCONSOLE
185172

186-
==== Enroll additional nodes
187-
188-
When you start {es} for the first time, the installation process configures a single-node cluster by default. This process also generates an enrollment token
189-
and prints it to your terminal. If you want a node to join an existing cluster,
190-
start the new node with the generated enrollment token.
173+
===== Add more nodes
191174

175+
. Use an existing node to generate a enrollment token for the new node.
176+
+
192177
--
193-
.Generating enrollment tokens
194-
****
195-
The enrollment token is valid for 30 minutes. If you need to generate a
196-
new enrollment token, run the
197-
<<create-enrollment-token,`elasticsearch-create-enrollment-token`>> tool on your
198-
existing node. This tool is available in the {es} `bin` directory of the Docker
199-
container.
200-
201-
For example, run the following command on the existing `es01` node to
202-
generate an enrollment token for new {es} nodes:
203-
204178
[source,sh]
205179
----
206180
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node
207181
----
208-
****
209-
--
210182

211-
. In the terminal where you started your first node, copy the generated
212-
enrollment token for adding new {es} nodes.
183+
The enrollment token is valid for 30 minutes.
184+
--
213185

214-
. On your new node, start {es} and include the generated enrollment token.
186+
. Start a new {es} container. Include the enrollment token as an environment variable.
215187
+
216188
--
217189
ifeval::["{release-state}"=="unreleased"]
@@ -228,10 +200,16 @@ docker run -e ENROLLMENT_TOKEN="<token>" --name es02 --net elastic -it {docker-i
228200
----
229201

230202
endif::[]
231-
232-
{es} is now configured to join the existing cluster.
233203
--
234204

205+
. Call the <<cat-nodes,cat nodes API>> to verify the node was added to the cluster.
206+
+
207+
[source,sh]
208+
----
209+
curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200/_cat/nodes
210+
----
211+
// NOTCONSOLE
212+
235213
===== Setting JVM heap size
236214
If you experience issues where the container where your first node is running
237215
exits when your second node starts, explicitly set values for the JVM heap size.

0 commit comments

Comments
 (0)