1.故障现象: 阿里云ECS服务器:Welcome to ubuntu 22.04.2 LTS (GNU/linux 5.15.0-73-generic x86_64) 上用Docker部署elast
阿里云ECS服务器:Welcome to ubuntu 22.04.2 LTS (GNU/linux 5.15.0-73-generic x86_64)
上用Docker部署elasticsearch服务。
因为偷懒直接用的 snap软件包管理器安装的docker。安装docker的版本信息为:
部署es或者Redis等服务时,发现用docker挂载一直比较奇怪。要么是报错:
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/data/redis/conf/redis.conf" to rootfs at "/etc/redis/redis.conf": mount /data/redis/conf/redis.conf:/etc/redis/redis.conf (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
大概意思是:把文件/data/redis/conf/redis.conf挂载到目录上 /etc/redis/redis.conf
docker把挂载文件解析成了目录(/etc/redis/redis.conf),或者反向:把/data/redis/conf/redis.conf 解析成目录,/etc/redis/redis.conf解析成文件。所以报错,目录不能挂载到文件上。
要么是elasticsearch启动时报错:
root@i3rm4tzkh:/dockerdir/tools# docker logs -f esOpenjdk 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.[2023-08-24T01:47:35,687][INFO ][o.e.n.node ] [] initializing ...[2023-08-24T01:47:35,704][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.4.3.jar:6.4.3] at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.4.3.jar:6.4.3]Caused by: java.lang.IllegalStateException: Failed to create node environment at org.elasticsearch.node.Node.(Node.java:277) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.node.Node.(Node.java:256) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:213) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.4.3.jar:6.4.3] ... 6 moreCaused by: java.NIO.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?] at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:385) ~[?:?] at java.nio.file.Files.createDirectory(Files.java:682) ~[?:?] at java.nio.file.Files.createAndCheckIsDirectory(Files.java:789) ~[?:?] at java.nio.file.Files.createDirectories(Files.java:775) ~[?:?] at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:207) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.node.Node.(Node.java:274) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.node.Node.(Node.java:256) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:213) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.4.3.jar:6.4.3] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.4.3.jar:6.4.3] ... 6 more
另附运行脚本:
docker run -d --name es -e "ES_JAVA_OPTS=-Xms4096m -Xmx4096m" -e "discovery.type=single-node" -v /data/elasticsearch/data:/usr/share/elasticsearch/data:rw -v /data/elasticsearch/plugins:/usr/share/elasticsearch/plugins:rw --privileged -p 9200:9200 -p 9300:9300 elasticsearch:6.4.3
百度后做过各种尝试都没成功:
各种尝试都失败后怀疑是es版本问题。修改es版本后结果问题依旧。
最终解决:找了个其他环境的docker版本:23.0.2 【问题解决】
root@iZwz93rm3yZ:~# docker versionClient: Docker Engine - CommUnity Version: 23.0.2 api version: 1.42 Go version: go1.19.7 git commit: 569dd73 Built: Mon Mar 27 16:16:30 2023 OS/Arch: linux/amd64 Context: defaultServer: Docker Engine - Community Engine: Version: 23.0.2 API version: 1.42 (minimum version 1.12) Go version: go1.19.7 Git commit: 219f21b Built: Mon Mar 27 16:16:30 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.22 GitCommit: 8165feabfdfe38c65b599c4993D227328c231fca runc: Version: 1.1.8 GitCommit: v1.1.8-0-g82f18fe docker-init: Version: 0.19.0 GitCommit: de40ad0
来源地址:https://blog.csdn.net/d495435207/article/details/132467445
--结束END--
本文标题: 【docker挂载问题】( OCI runtime create failed: runc create failed)和 (java.nio.file.AccessDeniedException)
本文链接: https://lsjlt.com/news/431443.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-04-01
2024-04-03
2024-04-03
2024-01-21
2024-01-21
2024-01-21
2024-01-21
2023-12-23
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0