- I tried to mount elasticsearch.ymlandkibana.ymlinside docker-compose.yml.
- For kibana, it is very smooth, but for Elasticsearch, an exception is thrown and the corresponding service is aborted, which confuses me. The following is the log output by Elasticsearch on the docker daemon.
Exception in thread "main" java.nio.file.FileSystemException: /usr/share/elasticsearch/config/elasticsearch.yml.cvrM1wfsRz-M7StPG7vFHw.tmp -> /usr/share/elasticsearch/config/elasticsearch.yml: Device or resource busy
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at java.base/sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:416)
at java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:266)
at java.base/java.nio.file.Files.move(Files.java:1432)
at org.elasticsearch.xpack.security.cli.AutoConfigureNode.fullyWriteFile(AutoConfigureNode.java:1136)
at org.elasticsearch.xpack.security.cli.AutoConfigureNode.fullyWriteFile(AutoConfigureNode.java:1148)
at org.elasticsearch.xpack.security.cli.AutoConfigureNode.execute(AutoConfigureNode.java:687)
at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:81)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.Command.main(Command.java:77)
at org.elasticsearch.xpack.security.cli.AutoConfigureNode.main(AutoConfigureNode.java:157)
- I give below two files elasticsearch-node01.ymlandkibana-node01.ymlin the same directory. The first iselasticsearch-node01.yml.
bootstrap.memory_lock: true
network.host: 0.0.0.0
Then kibana-node01.yml.
# copy the defaults to the custom file, refer to https://www.elastic.co/guide/en/kibana/8.1/docker.html#docker-defaults
server.host: 0.0.0.0
server.shutdownTimeout: 5s
elasticsearch.hosts: ['http://elasticsearch:9200']
monitoring.ui.container.elasticsearch.enabled: true
- 
I can be sure that I have executed wsl -d docker-desktopandsysctl -w vm.max_map_count=262144to get rid of the limit, but I am completely unable to understand whyelasticsearch-node01.ymlafter creating the file multiple times mount fails, while thekibana.ymlmounts fine. In addition, I need to clarify that if theelasticsearch-node01.ymlis deleted and the configuration is placed in the environment variables of thedocker-compose.yml, everything works fine.
- 
A reproduced repository is at GitHub - linghengqian/elasticsearch-docker-compose-test: elasticsearch-docker-compose-test . 
- 
Any help or reminders are appreciated. 

