@@ -39,7 +39,7 @@ adjust memory usage in Docker Desktop by going to **Settings > Resources**.
39
39
----
40
40
docker network create elastic
41
41
----
42
-
42
+ // REVIEWED[DEC.10.24]
43
43
. Pull the {es} Docker image.
44
44
+
45
45
--
@@ -52,10 +52,11 @@ endif::[]
52
52
----
53
53
docker pull {docker-image}
54
54
----
55
+ // REVIEWED[DEC.10.24]
55
56
--
56
57
57
58
. Optional: Install
58
- https://docs.sigstore.dev/system_config/installation/[Cosign] for your
59
+ https://docs.sigstore.dev/cosign/ system_config/installation/[Cosign] for your
59
60
environment. Then use Cosign to verify the {es} image's signature.
60
61
+
61
62
[[docker-verify-signature]]
@@ -64,6 +65,7 @@ environment. Then use Cosign to verify the {es} image's signature.
64
65
wget https://artifacts.elastic.co/cosign.pub
65
66
cosign verify --key cosign.pub {docker-image}
66
67
----
68
+ // REVIEWED[DEC.10.24]
67
69
+
68
70
The `cosign` command prints the check results and the signature payload in JSON format:
69
71
+
@@ -75,13 +77,15 @@ The following checks were performed on each of these signatures:
75
77
- Existence of the claims in the transparency log was verified offline
76
78
- The signatures were verified against the specified public key
77
79
----
80
+ // REVIEWED[DEC.10.24]
78
81
79
82
. Start an {es} container.
80
83
+
81
84
[source,sh,subs="attributes"]
82
85
----
83
86
docker run --name es01 --net elastic -p 9200:9200 -it -m 1GB {docker-image}
84
87
----
88
+ // REVIEWED[DEC.10.24]
85
89
+
86
90
TIP: Use the `-m` flag to set a memory limit for the container. This removes the
87
91
need to <<docker-set-heap-size,manually set the JVM size>>.
@@ -95,6 +99,7 @@ If you intend to use the {ml} capabilities, then start the container with this c
95
99
----
96
100
docker run --name es01 --net elastic -p 9200:9200 -it -m 6GB -e "xpack.ml.use_auto_machine_memory_percent=true" {docker-image}
97
101
----
102
+ // REVIEWED[DEC.10.24]
98
103
The command prints the `elastic` user password and an enrollment token for {kib}.
99
104
100
105
. Copy the generated `elastic` password and enrollment token. These credentials
@@ -106,20 +111,23 @@ credentials using the following commands.
106
111
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
107
112
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
108
113
----
114
+ // REVIEWED[DEC.10.24]
109
115
+
110
116
We recommend storing the `elastic` password as an environment variable in your shell. Example:
111
117
+
112
118
[source,sh]
113
119
----
114
120
export ELASTIC_PASSWORD="your_password"
115
121
----
122
+ // REVIEWED[DEC.10.24]
116
123
117
124
. Copy the `http_ca.crt` SSL certificate from the container to your local machine.
118
125
+
119
126
[source,sh]
120
127
----
121
128
docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
122
129
----
130
+ // REVIEWED[DEC.10.24]
123
131
124
132
. Make a REST API call to {es} to ensure the {es} container is running.
125
133
+
@@ -128,6 +136,7 @@ docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
128
136
curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200
129
137
----
130
138
// NOTCONSOLE
139
+ // REVIEWED[DEC.10.24]
131
140
132
141
===== Add more nodes
133
142
@@ -137,6 +146,7 @@ curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200
137
146
----
138
147
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node
139
148
----
149
+ // REVIEWED[DEC.10.24]
140
150
+
141
151
The enrollment token is valid for 30 minutes.
142
152
@@ -146,6 +156,7 @@ The enrollment token is valid for 30 minutes.
146
156
----
147
157
docker run -e ENROLLMENT_TOKEN="<token>" --name es02 --net elastic -it -m 1GB {docker-image}
148
158
----
159
+ // REVIEWED[DEC.10.24]
149
160
150
161
. Call the <<cat-nodes,cat nodes API>> to verify the node was added to the cluster.
151
162
+
@@ -154,6 +165,7 @@ docker run -e ENROLLMENT_TOKEN="<token>" --name es02 --net elastic -it -m 1GB {d
154
165
curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200/_cat/nodes
155
166
----
156
167
// NOTCONSOLE
168
+ // REVIEWED[DEC.10.24]
157
169
158
170
[[run-kibana-docker]]
159
171
===== Run {kib}
@@ -170,6 +182,7 @@ endif::[]
170
182
----
171
183
docker pull {kib-docker-image}
172
184
----
185
+ // REVIEWED[DEC.10.24]
173
186
--
174
187
175
188
. Optional: Verify the {kib} image's signature.
@@ -179,13 +192,15 @@ docker pull {kib-docker-image}
179
192
wget https://artifacts.elastic.co/cosign.pub
180
193
cosign verify --key cosign.pub {kib-docker-image}
181
194
----
195
+ // REVIEWED[DEC.10.24]
182
196
183
197
. Start a {kib} container.
184
198
+
185
199
[source,sh,subs="attributes"]
186
200
----
187
201
docker run --name kib01 --net elastic -p 5601:5601 {kib-docker-image}
188
202
----
203
+ // REVIEWED[DEC.10.24]
189
204
190
205
. When {kib} starts, it outputs a unique generated link to the terminal. To
191
206
access {kib}, open this link in a web browser.
@@ -198,6 +213,7 @@ To regenerate the token, run:
198
213
----
199
214
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
200
215
----
216
+ // REVIEWED[DEC.10.24]
201
217
202
218
. Log in to {kib} as the `elastic` user with the password that was generated
203
219
when you started {es}.
@@ -208,6 +224,7 @@ To regenerate the password, run:
208
224
----
209
225
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
210
226
----
227
+ // REVIEWED[DEC.10.24]
211
228
212
229
[[remove-containers-docker]]
213
230
===== Remove containers
@@ -226,6 +243,7 @@ docker rm es02
226
243
# Remove the {kib} container
227
244
docker rm kib01
228
245
----
246
+ // REVIEWED[DEC.10.24]
229
247
230
248
===== Next steps
231
249
@@ -306,6 +324,7 @@ ES_PORT=127.0.0.1:9200
306
324
----
307
325
docker-compose up -d
308
326
----
327
+ // REVIEWED[DEC.10.24]
309
328
310
329
. After the cluster has started, open http://localhost:5601 in a web browser to
311
330
access {kib}.
@@ -321,6 +340,7 @@ is preserved and loaded when you restart the cluster with `docker-compose up`.
321
340
----
322
341
docker-compose down
323
342
----
343
+ // REVIEWED[DEC.10.24]
324
344
325
345
To delete the network, containers, and volumes when you stop the cluster,
326
346
specify the `-v` option:
@@ -329,6 +349,7 @@ specify the `-v` option:
329
349
----
330
350
docker-compose down -v
331
351
----
352
+ // REVIEWED[DEC.10.24]
332
353
333
354
===== Next steps
334
355
@@ -377,6 +398,7 @@ The `vm.max_map_count` setting must be set within the xhyve virtual machine:
377
398
--------------------------------------------
378
399
screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
379
400
--------------------------------------------
401
+ // REVIEWED[DEC.10.24]
380
402
381
403
. Press enter and use `sysctl` to configure `vm.max_map_count`:
382
404
+
@@ -494,6 +516,7 @@ To check the Docker daemon defaults for ulimits, run:
494
516
--------------------------------------------
495
517
docker run --rm {docker-image} /bin/bash -c 'ulimit -Hn && ulimit -Sn && ulimit -Hu && ulimit -Su'
496
518
--------------------------------------------
519
+ // REVIEWED[DEC.10.24]
497
520
498
521
If needed, adjust them in the Daemon or override them per container.
499
522
For example, when using `docker run`, set:
@@ -502,6 +525,7 @@ For example, when using `docker run`, set:
502
525
--------------------------------------------
503
526
--ulimit nofile=65535:65535
504
527
--------------------------------------------
528
+ // REVIEWED[DEC.10.24]
505
529
506
530
===== Disable swapping
507
531
@@ -518,6 +542,7 @@ When using `docker run`, you can specify:
518
542
----
519
543
-e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1
520
544
----
545
+ // REVIEWED[DEC.10.24]
521
546
522
547
===== Randomize published ports
523
548
@@ -545,6 +570,7 @@ environment variable. For example, to use 1GB, use the following command.
545
570
----
546
571
docker run -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -e ENROLLMENT_TOKEN="<token>" --name es01 -p 9200:9200 --net elastic -it {docker-image}
547
572
----
573
+ // REVIEWED[DEC.10.24]
548
574
549
575
The `ES_JAVA_OPTS` variable overrides all other JVM options.
550
576
We do not recommend using `ES_JAVA_OPTS` in production.
@@ -616,6 +642,7 @@ If you mount the password file to `/run/secrets/bootstrapPassword.txt`, specify:
616
642
--------------------------------------------
617
643
-e ELASTIC_PASSWORD_FILE=/run/secrets/bootstrapPassword.txt
618
644
--------------------------------------------
645
+ // REVIEWED[DEC.10.24]
619
646
620
647
You can override the default command for the image to pass {es} configuration
621
648
parameters as command line options. For example:
0 commit comments