Docker:没有足够的内存让Java Runtime Environment继续运行

时间:2019-06-24 20:50:20

标签: docker

我正在尝试启动docker容器;容器以状态代码1退出,表示错误。看起来像是内存错误;但是,请求的内存(〜900Mo)小于可用的内存(〜8Go)。 docker logs产生以下错误:

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000ca660000, 899284992, 0) failed; error='Not enough space' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 899284992 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid1.log

我的docker info is as such

Containers: 5
 Running: 0
 Paused: 0
 Stopped: 5
Images: 32
Server Version: 18.09.2
Storage Driver: windowsfilter (windows) lcow (linux)
 Windows:
 LCOW:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: ics l2bridge l2tunnel nat null overlay transparent
 Log: awslogs etwlogs fluentd gelf json-file local logentries splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 17134 (17134.1.amd64fre.rs4_release.180410-1804)
Operating System: Windows 10 Pro Version 1803 (OS Build 17134.829)
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 7.813GiB
Name: DESKTOP-OB3P5AU
ID: AYR7:F43F:MI7W:4JSM:EA5V:VXNB:T3HP:ZTL2:AZ2F:KFCM:463Q:RXJG
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: -1
 Goroutines: 26
 System Time: 2019-06-24T22:41:43.3487574+02:00
 EventsListeners: 1
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

你知道我该怎么解决吗?

有关信息,我的Dockerfile就这样,构建图像时没有问题。

FROM python:3.6-alpine

RUN adduser -D microblog

WORKDIR /home/microblog

COPY requirements.txt requirements.txt
RUN python -m venv venv
RUN apk add --no-cache --virtual .pynacl_deps build-base python3-dev libffi-dev
RUN venv/bin/pip install -r requirements.txt
RUN venv/bin/pip install gunicorn
RUN venv/bin/pip install gunicorn 'pymysql<0.9'

COPY app app
COPY migrations migrations
COPY microblog.py config.py boot.sh ./
RUN chmod +x boot.sh

ENV FLASK_APP microblog.py

RUN chown -R microblog:microblog ./
USER microblog

EXPOSE 5000
ENTRYPOINT ["./boot.sh"]

1 个答案:

答案 0 :(得分:-1)

在AWS上运行docker时遇到相同的问题。但是您可以通过将以下参数传递给docker来增加Java可用于运行应用程序的内存来解决此问题: -e ES_JAVA_OPTS =“-Xms108m -Xmx108m”

希望这会有所帮助! l!