# 拉取镜像
docker pull sebp/elk

# 启动
docker run -p 5601:5601 -p 9200:9200 -p 5044:5044 -v /opt/docker-data:/data -it -d --name elk sebp/elk

# 查看容器状态
docker container list -a

# 发现启动失败

# 查看日志
docker logs 你的容器ID

日志错误信息:

[2020-05-17T10:13:19,079][ERROR][o.e.b.Bootstrap          ] [elk] node validation exception
 [1] bootstrap checks failed
 [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
 [2020-05-17T10:13:19,084][INFO ][o.e.n.Node               ] [elk] stopping ...
 [2020-05-17T10:13:19,108][INFO ][o.e.n.Node               ] [elk] stopped
 [2020-05-17T10:13:19,108][INFO ][o.e.n.Node               ] [elk] closing ...
 [2020-05-17T10:13:19,139][INFO ][o.e.n.Node               ] [elk] closed
 [2020-05-17T10:13:19,142][INFO ][o.e.x.m.p.NativeController] [elk] Native controller process has stopped - no new native processes can be started

根据日志,是启动检查失败(bootstrap check failed),具体原因是虚拟内存空间太小了 (max virtual memory areas vm.max_map_count [65530] is too low),解决办法是将其调整到至少 262144 (increase to at least [262144])。

切换到root,执行:

sysctl -w vm.max_map_count=262144

查看是否调整成功:

sysctl -a | grep vm.max_map_count

如果看到 vm.max_map_count 的值变大了就说明 work 了。

不过上面这个修改办法是临时的,重启 docker 虚拟机就失效了。

永久生效的办法是在 /etc/sysctl.conf 文件后面添加一行:

vm.max_map_count=262144

即可。

参考

标签: docker

添加新评论