基于tini的openjdk8镜像
基于tini的openjdk8镜像
FROM openjdk:8-jdk-alpine
#jdk采用openjdk8,操作系统采用alpine,减小体积
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
#修改镜像源为阿里源
ENV LANG=en_US.UTF-8
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
#修改时区及默认字符集
RUN apk add --update --no-cache ttf-dejavu fontconfig busybox-extras iproute2 curl net-tools tcpdump wget&& \
apk --update --no-cache add tini && \
rm -rf /var/cache/apk/*
#添加常用工具及字符集字体等
#采用tini运行java,提高运行可靠性,防止僵尸进程,并且方便适应jdk自带命令
#***.jar 替换为需要运行的jar
ENTRYPOINT tini java $JAVA_OPTS -jar /***.jar
基于tini的openjdk8镜像——生产环境
#FROM fiadliel/java8-jre
#jdk采用openjdk8,操作系统采用alpine,减小体积
FROM openjdk:8-jdk-alpine
#修改镜像源为阿里源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
#修改时区及默认字符集
ENV LANG=en_US.UTF-8
VOLUME /tmp
ADD play-api-*.jar play-api-3.0.0-release.jar
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
#添加常用工具及字符集字体等
#采用tini运行java,提高运行可靠性,防止僵尸进程,并且方便适应jdk自带命令
RUN apk add --update --no-cache ttf-dejavu fontconfig busybox-extras iproute2 lrzsz unzip curl net-tools tcpdump wget&& \
apk --update --no-cache add tini && \
rm -rf /var/cache/apk/*
ENTRYPOINT ["tini","java","-Djava.security.egd=file:/dev/./urandom","-jar","/play-api-3.0.0-release.jar"]
jstack、jmap等工具目录
cd /usr/lib/jvm/java-1.8-openjdk/bin
openjdk8镜像(jvm内存分析命令齐全)——适合非生产环境jvm内存分析使用
FROM adoptopenjdk/openjdk8
MAINTAINER Lynch <416501600@qq.com>
# 修改镜像源为阿里源
RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN apt-get update
#RUN apt-get upgrade -y
#设置默认字符集及java环境变量
ENV LANG=en_US.UTF-8 \
JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk \
PATH=$PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin \
run_foreground=true
#修改时区
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
#添加常用工具及字符集字体等
RUN apt-get install -y ttf-dejavu fontconfig curl net-tools tcpdump vim wget lrzsz unzip
RUN apt-get install -y bash-completion
RUN exec bash
RUN apt-get autoclean
RUN apt-get autoremove
VOLUME /tmp
ADD play-api-*.jar play-api-3.0.0-release.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/play-api-3.0.0-release.jar"]