Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail when start a new container #133

Closed
rpayanm opened this issue Oct 31, 2016 · 4 comments
Closed

Fail when start a new container #133

rpayanm opened this issue Oct 31, 2016 · 4 comments

Comments

@rpayanm
Copy link

rpayanm commented Oct 31, 2016

I run:

$ docker run --rm -ti -p 9200:9200 -p 9300:9300 elasticsearch

But I can't start elasticsearch 5.0, here the log:

Unable to find image 'elasticsearch:latest' locally
latest: Pulling from library/elasticsearch

43c265008fae: Already exists 
af36d2c7a148: Already exists 
2b7b4d10e1c1: Already exists 
9f7579daddb2: Already exists 
a985511f2468: Already exists 
6c2b485fcc3e: Already exists 
00b73c83b440: Already exists 
a38975861823: Pull complete 
b9d0b4aaf934: Pull complete 
f5f25bb3de04: Pull complete 
93426e1e8953: Pull complete 
590c2ab9b639: Pull complete 
31bf48850601: Pull complete 
21aad7ce70fa: Pull complete 
Digest: sha256:29205bca045c8d083f777dfc453f4f1ff3d2c08ea4f529f88795166c58e5607e
Status: Downloaded newer image for elasticsearch:latest
[2016-10-31T20:56:22,023][INFO ][o.e.n.Node               ] [] initializing ...
[2016-10-31T20:56:22,129][INFO ][o.e.e.NodeEnvironment    ] [N-vpIo0] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/sda8)]], net usable_space [48.7gb], net total_space [98.3gb], spins? [possibly], types [ext4]
[2016-10-31T20:56:22,130][INFO ][o.e.e.NodeEnvironment    ] [N-vpIo0] heap size [1.9gb], compressed ordinary object pointers [true]
[2016-10-31T20:56:22,130][INFO ][o.e.n.Node               ] [N-vpIo0] node name [N-vpIo0] derived from node ID; set [node.name] to override
[2016-10-31T20:56:22,132][INFO ][o.e.n.Node               ] [N-vpIo0] version[5.0.0], pid[1], build[253032b/2016-10-26T05:11:34.737Z], OS[Linux/3.16.0-4-amd64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_102/25.102-b14]
[2016-10-31T20:56:22,785][INFO ][o.e.p.PluginsService     ] [N-vpIo0] loaded module [aggs-matrix-stats]
[2016-10-31T20:56:22,785][INFO ][o.e.p.PluginsService     ] [N-vpIo0] loaded module [ingest-common]
[2016-10-31T20:56:22,785][INFO ][o.e.p.PluginsService     ] [N-vpIo0] loaded module [lang-expression]
[2016-10-31T20:56:22,785][INFO ][o.e.p.PluginsService     ] [N-vpIo0] loaded module [lang-groovy]
[2016-10-31T20:56:22,785][INFO ][o.e.p.PluginsService     ] [N-vpIo0] loaded module [lang-mustache]
[2016-10-31T20:56:22,785][INFO ][o.e.p.PluginsService     ] [N-vpIo0] loaded module [lang-painless]
[2016-10-31T20:56:22,785][INFO ][o.e.p.PluginsService     ] [N-vpIo0] loaded module [percolator]
[2016-10-31T20:56:22,785][INFO ][o.e.p.PluginsService     ] [N-vpIo0] loaded module [reindex]
[2016-10-31T20:56:22,785][INFO ][o.e.p.PluginsService     ] [N-vpIo0] loaded module [transport-netty3]
[2016-10-31T20:56:22,785][INFO ][o.e.p.PluginsService     ] [N-vpIo0] loaded module [transport-netty4]
[2016-10-31T20:56:22,786][INFO ][o.e.p.PluginsService     ] [N-vpIo0] no plugins loaded
[2016-10-31T20:56:22,875][WARN ][o.e.d.s.g.GroovyScriptEngineService] [groovy] scripts are deprecated, use [painless] scripts instead
[2016-10-31T20:56:24,241][INFO ][o.e.n.Node               ] [N-vpIo0] initialized
[2016-10-31T20:56:24,241][INFO ][o.e.n.Node               ] [N-vpIo0] starting ...
[2016-10-31T20:56:24,380][INFO ][o.e.t.TransportService   ] [N-vpIo0] publish_address {172.17.0.4:9300}, bound_addresses {[::]:9300}
[2016-10-31T20:56:24,389][INFO ][o.e.b.BootstrapCheck     ] [N-vpIo0] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
[2016-10-31T20:56:24,400][INFO ][o.e.n.Node               ] [N-vpIo0] stopping ...
[2016-10-31T20:56:24,426][INFO ][o.e.n.Node               ] [N-vpIo0] stopped
[2016-10-31T20:56:24,426][INFO ][o.e.n.Node               ] [N-vpIo0] closing ...
[2016-10-31T20:56:24,433][INFO ][o.e.n.Node               ] [N-vpIo0] closed

Please, How can I solve this issue?

@allansene
Copy link

As said at the Docker image documentation in Host Setup section:

Note: since 5.0, Elasticsearch only listens on localhost by default, so this image sets network.host to 0.0.0.0 (given that localhost is not terribly useful in the Docker context).

As a result, Elasticsearch is more strict about the bootstrap checks that it performs, especially when checking the value of vm.max_map_count which is not namespaced and thus must be set to an acceptable value on the host (as opposed to simply using --sysctl on docker run).

So you just have to execute this on the host machine:

sysctl -w vm.max_map_count=262144

And you are good to go with the 5.0.0 version

To set this value permanently, update the vm.max_map_count setting in /etc/sysctl.conf. To verify after rebooting, run sysctl vm.max_map_count.

More information here

@rpayanm
Copy link
Author

rpayanm commented Nov 1, 2016

Thank you, now i can work with elasticsearch 5.0.

I clone this repository and add this line to Dockerfile:

RUN echo "vm.max_map_count=262144" >> /etc/sysctl.conf

and I ran:

$ docker build .

Can be a pull request?

@tianon
Copy link
Member

tianon commented Nov 1, 2016

@rpayanm the issue with that is that /etc/sysctl.conf inside the container is not sourced at container startup, and the value of vm.max_map_count has to be set on the host, not inside the container, so the best we can do from the image point of view is the documentation snippet we added over in docker-library/docs#734 😞

@rpayanm
Copy link
Author

rpayanm commented Nov 1, 2016

Ohhhh I understand.

Thank you.

@rpayanm rpayanm closed this as completed Nov 1, 2016
1gtm pushed a commit to appscode-images/elasticsearch that referenced this issue Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants