我似乎根本无法在服务器上的 Docker 容器中运行 java。即使在发行时java -version
,我收到以下错误。
root@86088d679103:/# java -version
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000035ce1000000, 2555904, 1) failed; error='Operation not permitted' (errno=1)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2555904 bytes for committing reserved memory.
# An error report file with more information is saved as:
# //hs_err_pid17.log
据此,java无法映射2.5Mb的空间用于保留内存?这似乎不对……
我在最后包含了完整的日志,但为了获得一些额外的信息,我的系统报告以下内容:
root@86088d679103:/# uname -m
x86_64
root@86088d679103:/# free -mh
total used free shared buffers cached
Mem: 15G 9.7G 5.8G 912K 148M 8.9G
-/+ buffers/cache: 639M 14G
Swap: 15G 0B 15G
有人能指出我正确的方向吗?
完整日志:https://gist.github.com/KayoticSully/e206c44681ce261674ba
Update
@Yobert 解决了这个问题,我强烈建议您阅读评论和聊天日志。那里有很好的信息。
对于那些想要使 Java 运行的最终命令的人:setfattr -n user.pax.flags -v "mr" /usr/bin/java
如果您的发行版没有setfattr
默认安装,它应该通过paceman、apt-get等包含在可安装包attr中。