Analysis of the cause of docker error Exited (1) 4 minutes ago

Analysis of the cause of docker error Exited (1) 4 minutes ago

Docker error

1. Check the cause

docker logs nexus

2. Cause of error

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e7000000, 419430400, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 419430400 bytes for committing reserved memory. # An error report file with more information is saved as: # /opt/sonatype/nexus/hs_err_pid1.log

Additional knowledge: Problems encountered when installing and running ElasticSearch with Docker!

After creating version 6.4.3 of ES, I started it and found that ES automatically exited after a while.

The reason seems to be that the default memory allocated by ES is too large. The process was automatically killed.

So let me record this pit below:

Error when running test method using ES tool class index

org.elasticsearch.transport.ConnectTransportException: [][192.168.235.9300] connect_timeout[30s]

It was found that the ES package imported using SpringBoot 2.x is incompatible with the ES version installed on Docker.

The Spring-Data-ES package introduced in SpringBoot 2.1.3 is: 3.1.5

The ES version installed by Docker is: 5.6.12

Check out the official documentation for the adaptation relationship:

It is found that 3.1.X requires ES version 6.2.2 or above

The ES Jar package integrated in my project is 6.4.3

Then we install ES version 6.4.3 in Docker

We use the official Docker China image to accelerate:

# docker pull registry.docker-cn.com/library/elasticsearch:6.4.3

After downloading, we create a container and start it:

//List all local images# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.docker-cn.com/library/rabbitmq 3-management 92682ab7dca0 12 days ago 212MB
registry.docker-cn.com/library/elasticsearch 6.4.3 01e5bee1e059 4 months ago 795MB
registry.docker-cn.com/library/elasticsearch latest 5acf0e8da90b 5 months ago 486MB

Since the default memory allocated to ES version after 5.0 is 2G, 1G is required when creating Docker, so we can set its environment variables in the parameters:

You can also change the corresponding jvm.options configuration

We create an ES running 6.4.3

# docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9201:9200 -p 9301:9300 --name ES02 01e5bee1e059

Then, after the following situation occurred, the ES container stopped automatically. :

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2019-03-06T03:29:17,534][INFO ][oenNode ] [] initializing ...
[2019-03-06T03:29:17,680][INFO ][oeeNodeEnvironment ] [gV0jbyu] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [13.6gb], net total_space [16.9gb], types [rootfs]
[2019-03-06T03:29:17,681][INFO ][oeeNodeEnvironment ] [gV0jbyu] heap size [247.6mb], compressed ordinary object pointers [true]
[2019-03-06T03:29:17,690][INFO ][oenNode ] [gV0jbyu] node name derived from node ID [gV0jbyuBSrmiqJJ8p524XA]; set [node.name] to override
[2019-03-06T03:29:17,691][INFO ][oenNode ] [gV0jbyu] version[6.4.3], pid[1], build[default/tar/fe40335/2018-10-30T23:17:19.084789Z], OS[Linux/3.10.0-957.5.1.el7.x86_64/amd64], JVM["Oracle Corporation"/OpenJDK 64-Bit Server VM/10.0.2/10.0.2+13]
[2019-03-06T03:29:17,691][INFO ][oenNode ] [gV0jbyu] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.GVv4IesY, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.cgroups.hierarchy.override=/, -Xms256m, -Xmx256m, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2019-03-06T03:29:22,164][INFO ][oepPluginsService ] [gV0jbyu] loaded module [aggs-matrix-stats]
.
.
.
[2019-03-06T03:29:26,129][WARN ][oedsScriptModule ] Script: returning default values ​​for missing document values ​​is deprecated. Set system property '-Des.scripting.exception_for_missing_value=true' to make behaviour compatible with future major versions.
[2019-03-06T03:29:30,804][INFO ][oexsasFileRolesStore] [gV0jbyu] parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]
[2019-03-06T03:29:31,986][INFO ][oexmjplCppLogMessageHandler] [controller/62] [Main.cc@109] controller (64 bit): Version 6.4.3 (Build 7a0781676dd492) Copyright (c) 2018 Elasticsearch BV
[2019-03-06T03:29:32,929][INFO ][oedDiscoveryModule ] [gV0jbyu] using discovery type [zen]
[2019-03-06T03:29:34,282][INFO ][oenNode ] [gV0jbyu] initialized
[2019-03-06T03:29:34,283][INFO ][oenNode ] [gV0jbyu] starting ...
[2019-03-06T03:29:34,625][INFO ][oetTransportService ] [gV0jbyu] publish_address {172.17.0.2:9300}, bound_addresses {0.0.0.0:9300}
[2019-03-06T03:29:34,656][INFO ][oebBootstrapChecks ] [gV0jbyu] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2019-03-06T03:29:34,721][INFO ][oenNode ] [gV0jbyu] stopping ...
[2019-03-06T03:29:34,760][INFO ][oenNode ] [gV0jbyu] stopped
[2019-03-06T03:29:34,760][INFO ][oenNode ] [gV0jbyu] closing ...
[2019-03-06T03:29:34,778][INFO ][oenNode ] [gV0jbyu] closed
[2019-03-06T03:29:34,780][INFO ][oexmjpNativeController] Native controller process has stopped - no new native processes can be started

I output the error log and roughly translated it to see this sentence:

[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

It says that the maximum virtual memory area vm.max_map_count is set to 65530 which is too low and should be increased to at least 262144

I searched Baidu online for the setting method:

# sudo sysctl -w vm.max_map_count=262144

Then we start ES again

# docker start ES02

Let's check its status again later:

# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bdaed6794ca6 5acf0e8da90b "/docker-entrypoint.…" 5 minutes ago Exited (130) 6 seconds ago ES01
7d2dcc5512ee 01e5bee1e059 "/usr/local/bin/dock…" 3 hours ago Up 15 minutes 0.0.0.0:9201->9200/tcp, 0.0.0.0:9301->9300/tcp ES02
d372501cc505 92682ab7dca0 "docker-entrypoint.s…" 4 days ago Exited (0) 22 hours ago myrabbitmq

After finding that it is started normally, let's access the port corresponding to http:

http://192.168.235.128:9201/

We found that there was no problem with the 6.4.3 version of ES we installed.

The above analysis of the cause of the docker error Exited (1) 4 minutes ago is all I have to share with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Tutorial on installing Elasticsearch 7.6.2 in Docker
  • Solve the problem of Docker starting Elasticsearch7.x and reporting an error
  • Implementation of Docker container state conversion
  • Solution to the automatic termination of docker run container
  • After docker run, the status is always Exited
  • Docker cleanup environment operation

<<:  Detailed explanation of the principle of Vue monitoring data

>>:  Detailed explanation of several horizontal and vertical centering methods in HTML (Basics)

Recommend

Problems installing TensorRT in docker container

Uninstall the installed version on Ubuntu: sudo a...

JavaScript function syntax explained

Table of contents 1. Ordinary functions 2. Arrow ...

Introducing the code checking tool stylelint to share practical experience

Table of contents Preface text 1. Install styleli...

How to use JavaScript and CSS correctly in XHTML documents

In more and more websites, the use of XHTML is rep...

Complete steps to quickly configure HugePages under Linux system

Preface Regarding HugePages and Oracle database o...

Analysis of the Linux input subsystem framework principle

Input subsystem framework The linux input subsyst...

Quick solution for forgetting MySQL8 password

Preface When we forget the MySQL database passwor...

Uniapp's experience in developing small programs

1. Create a new UI project First of all, our UI i...

ElementUI implements sample code for drop-down options and multiple-select boxes

Table of contents Drop-down multiple-select box U...

Implementation of Redis master-slave cluster based on Docker

Table of contents 1. Pull the Redis image 2. Crea...

Introduction to TypeScript interfaces

Table of contents 1. Interface definition 2. Attr...

Detailed explanation of box-sizing in CSS3 (content-box and border-box)

Box-sizing in CSS3 (content-box and border-box) T...

How to turn a jar package into a docker container

How to turn a jar package into a docker container...