查看docker jdk的版本:
docker exec container_name java -version
docker容器是依赖docker文件构建的,所以我们只需要修改docker文件的jdk配置即可
1 FROM openjdk:7u121-jre 2 3 ENV PROJECT_NAME dsc-settle-web 4 ENV DEPLOY_DIR /data/webroot/项目名 5 ENV VM_OPTION "-XX:MaxPermSize=128m -Xms128m -Xmx512m" 6 7 RUN mkdir -p ${DEPLOY_DIR}/${PROJECT_NAME} 8 COPY ./target/${PROJECT_NAME}/ ${DEPLOY_DIR}/${PROJECT_NAME} 9 ENTRYPOINT java ${VM_OPTION} -XX:OnOutOfMemoryError="kill -9 %p" -cp ${DEPLOY_DIR}/${PROJECT_NAME} org.springframework.boot.loader.JarLauncher
修改为
1 FROM openjdk:8u171-jdk 2 3 ENV PROJECT_NAME dsc-settle-web 4 ENV DEPLOY_DIR /data/webroot/项目名 5 ENV VM_OPTION "-XX:MaxPermSize=128m -Xms128m -Xmx512m" 6 7 RUN mkdir -p ${DEPLOY_DIR}/${PROJECT_NAME} 8 COPY ./target/${PROJECT_NAME}/ ${DEPLOY_DIR}/${PROJECT_NAME} 9 ENTRYPOINT java ${VM_OPTION} -XX:OnOutOfMemoryError="kill -9 %p" -cp ${DEPLOY_DIR}/${PROJECT_NAME} org.springframework.boot.loader.JarLauncher
重新发布docker项目即可
---------------------------------------------------------------
docker images 查看本地镜像
docker ps : 查看当前运行的容器信息
docker start [容器ID]:启动容器
docker exec -it [容器ID] /bin/bash : 进入容器
查看和安装jdk
yum -y list java*
yum install java版本名(如:java-11-openjdk.x86_64)