ものづくりのブログ

うちのネコを題材にしたものづくりができたらいいなと思っていろいろ奮闘してます。

【Elasticsearch】ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.

以下のコマンドを実行後にエラーで困ったので対応方法をここにメモします。

$ docker run --name es01 --net elastic -p 9200:9200 -p 9300:9300 -it docker.elastic.co/elasticsearch/elasticsearch:8.5.1
 ・
 ・
 ・
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.

調べてみたら対応方法が以下のサイトに書いてありました。
www.elastic.co


現在の 'vm.max_map_count' を確認します。

$ sudo sysctl -a | grep -F vm.max_map_count
vm.max_map_count = 65530

設定を変更します。

$ sudo sysctl -w vm.max_map_count=262144
vm.max_map_count = 262144

設定変更後の 'vm.max_map_count' を確認します。

$ sudo sysctl -a | grep -F vm.max_map_count
vm.max_map_count = 262144

コンテナを削除してくれとのこと...

$ docker run --name es01 --net elastic -p 9200:9200 -p 9300:9300 -it docker.elastic.co/elasticsearch/elasticsearch:8.5.1
docker: Error response from daemon: Conflict. The container name "/es01" is already in use by container "a98736009007f494ba80467a81a2990d43e7079f6b6bd92b44201ec81a24d851". You have to remove (or rename) that container to be able to reuse that name.

削除コマンド実行

$ docker system prune
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

Are you sure you want to continue? [y/N] y
Deleted Containers:
a98736009007f494ba80467a81a2990d43e7079f6b6bd92b44201ec81a24d851

Deleted Networks:
elastic

Total reclaimed space: 72.99kB

再度コマンドを実行したら起動に成功しました。

$ docker run --name es01 --net elastic -p 9200:9200 -p 9300:9300 -it docker.elastic.co/elasticsearch/elasticsearch:8.5.1