Docker:容器内的资源问题

时间:2018-02-26 07:38:35

标签: docker

我有一个运行centos7.4的容器。在这个容器内,我正在做各种各样的事情。我注意到非常频繁的问题,例如

clang-5.0: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable.  

并且

There is insufficient memory for the Java Runtime Environment to continue.
Cannot create GC thread. Out of system resources.
Error occurred during initialization of VM
java.lang.OutOfMemoryError: unable to create new native thread

make[1]: vfork: Resource temporarily unavailable

fork() failed: Command could not be run:

如果我执行相同的"各种各样的事情"在同一个Docker主机上,但在容器之外,我不会遇到问题。我试图了解这是否是我不知道的特定于docker的东西。 Docker默认继承主机的资源是否正确?即核心数和mem

我看到了这个然后我运行了docker stats

CONTAINER ID        NAME                CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
8cbc44773def        my-rh6     1.98%               48.59MiB / 251.6GiB   0.02%               33.8GB / 31.6GB     65.9MB / 11.5MB     26
683313a4e70e        my-rh7     85.99%              73.26MiB / 251.6GiB   0.03%               21.1GB / 1.31GB     269MB / 26.6MB      6

我的主机有72个核心和250G内存。 mem似乎是一样的。我不知道在250G可用的情况下java会怎么用完......

当我执行"各种各样的事情"我确实看到CPU%有时会超过1000%,我不确定它是否正常。如果我在容器外面运行相同的东西,sar并不会显示cpu消耗量接近1000%。 (有时最多70%)

0 个答案:

没有答案