docker google-chrome 内存过大
我的 Dockerfile 文件
FROM centos:7
ENV JAVA_HOME /usr/local/application/jdk1.8.0_371
ENV JRE_HOME $JAVA_HOME/jre
ENV CLASSPATH .:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
ENV PATH $PATH:$JAVA_HOME/bin
run mkdir /usr/local/application
ENV MYPATH /usr/local/application
WORKDIR $MYPATH
run curl -sL https://rpm.nodesource.com/setup_17.x | bash -
RUN yum update -y \
&& yum install -y wget \
&& yum install -y curl
run yum install -y epel-release
run yum install -y nodejs
run npm config set registry http://registry.npm.taobao.org/
run yum install -y google-chrome-stable_current_x86_64.rpm
run npm install -g log4js
run npm install -g typescript
ENV TZ=Asia/Shanghai
CMD ["sh","-c","npm run dev"]
我通过 docker run -v 的方式把 nodejs 应用(wechaty)挂载到容器内部,运行起来时,会启动 google-chrome。
容器做了内存限制,docker stats 查看内存是正常,但是 top 时发现 chrome 启动就使用了 16G 多的内存。
docker run -d -p 50002:22 -m 1024m --memory-swap 2048m \
-v /etc/localtime:/etc/localtime:ro \
-v /usr/local/applcation/jdk1.8.0_371:/usr/local/application/jdk1.8.0_371 \
-v /usr/local/applcation/my_nodejs/wechaty1/node_modules:/usr/local/application/wechaty/node_modules \
-v /usr/local/applcation/my_nodejs/wechaty1:/usr/local/application/wechaty \
-v /usr/local/applcation/my_nodejs/wechaty-java:/usr/local/application/wechaty-java \
-v /usr/local/applcation/my_nodejs/startup.sh:/usr/local/application/startup.sh \
-e serverPort=8080 \
-e serverUrl=http://127.0.0.1:8080 \
-e id=abc \
-e puppet_padlocal_token=abc \
-e web=web \
-e appName=wechaty-1 \
--privileged --name wechaty-1 centos7-wechaty
无解,不知道如何处理