java服务器错误,状态代码:400,错误代码:100005,消息:您已超过组织的内存限制
我正在尝试使用CloudFoundry将一个简单的Spring+Spring启动应用程序部署到IBMCloud。我的Docker文件如下所示:
# IBM Java SDK UBI is not available on public docker yet. Use regular
# base as builder until this is ready. For reference:
# https://github.com/ibmruntimes/ci.docker/tree/master/ibmjava/8/sdk/ubi-min
FROM ibmjava:8-sdk AS builder
LABEL maintainer="IBM Java Engineering at IBM Cloud"
WORKDIR /app
RUN apt-get update && apt-get install -y maven
COPY pom.xml .
RUN mvn -N io.takari:maven:wrapper -Dmaven=3.5.0
COPY . /app
RUN ./mvnw install
ARG bx_dev_user=root
ARG bx_dev_userid=1000
RUN BX_DEV_USER=$bx_dev_user
RUN BX_DEV_USERID=$bx_dev_userid
RUN if [ $bx_dev_user != "root" ]; then useradd -ms /bin/bash -u $bx_dev_userid $bx_dev_user; fi
# Multi-stage build. New build stage that uses the UBI as the base image.
# In the short term, we are using the OpenJDK for UBI. Long term, we will use
# the IBM Java Small Footprint JVM (SFJ) for UBI, but that is not in public
# Docker at the moment.
# (https://github.com/ibmruntimes/ci.docker/tree/master/ibmjava/8/sfj/ubi-min)
FROM adoptopenjdk/openjdk8:ubi-jre
# Copy over app from builder image into the runtime image.
RUN mkdir /opt/app
COPY --from=builder /app/target/javaspringapp-1.0-SNAPSHOT.jar /opt/app/app.jar
ENTRYPOINT [ "sh", "-c", "java -jar -XX:MaxRAM=10m /opt/app/app.jar" ]
如您所见,我已将我的应用程序限制为最多使用10MB,而我的实例有256MB可用空间。但是,每次部署应用程序时,都会出现以下错误:
另外,当我运行ps命令检查正在运行的进程时,没有任何东西会消耗我所有的内存
我在本地运行了相同的应用程序,它最多只需要25MB,所以我的实例的256MB就足够了。有什么办法解决这个问题吗
注意:很遗憾,目前不允许我增加实例的容量
[更新]所以我决定从头开始,在IBM云中创建一个新的Java Spring应用程序。IBM会自动将其设置为以this template开头,然后将其克隆到您的repo中。应用程序部署正常,我可以访问它
现在,我删除了HTML中的一行代码,并尝试再次部署。令我惊讶的是,我得到了:
FAILED
Error restarting application: Server error, status code: 400, error code: 100005, message: You have exceeded your organization's memory limit: app requested more memory than available
这怎么可能
# 1 楼答案
我找到了解决办法;这是相当出乎意料和违反直觉的。以下是我所做的:
注意:部署后,会覆盖实例的内存并分配192MB。为了在代码中执行任何进一步的更改,我需要在推送更改和部署应用程序之前将内存设置回64MB
# 2 楼答案
对于Lite帐户,为一个帐户部署的所有应用程序的内存限制为256 MB:
https://cloud.ibm.com/docs/account?topic=account-noruntimemem
您需要停止任何未使用的Cloud Foundry应用程序,或者升级您的帐户
在CloudFoundry中,您的显示。应用程序代码中的yml将指定内存