java Dockerfile 基础镜像制作()

Dockerfile

FROM openjdk:8-jdk-alpine

COPY ./STSONG.TTF /usr/share/fonts/
COPY ./arthas.zip /tmp/

ENV TZ=Asia/Shanghai

ENV LANG=zh_CN.UTF-8

RUN apk --no-cache add tzdata msttcorefonts-installer ttf-dejavu curl tini fontconfig && \
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    echo "Asia/Shanghai" > /etc/timezone && \
    update-ms-fonts && \
    fc-cache -vf && \
    mkdir /usr/local/arthas && \
    unzip /tmp/arthas.zip -d /usr/local/arthas && \
    rm -rf /tmp/arthas.zip
#   apk del tzdata
官方的java镜像满足不了要求,通常需要对其进行扩展,安装必要的软件等。
 
现就工作中常用到的java镜像Docker进行备份,以备后用
 
openjdk
 
# docker build -t java8:jdk-openjdk .
FROM openjdk:8
 
# 修改源
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
 
# 增加常用软件
RUN apt-get update; \
    apt-get install -y --no-install-recommends \
        net-tools \
    ; \
    rm -rf /var/lib/apt/lists/*
 
# 设置时区
RUN echo "Asia/Shanghai" > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 
 
amazoncorretto
 
# docker build -t java8:jdk-aws .
FROM amazoncorretto:8
 
# 增加常用软件
RUN yum install -y procps && yum install -y net-tools && yum clean all
 
# 设置时区
RUN echo "Asia/Shanghai" > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 
openj9
 
# docker build -t java8:jdk-openj9 .
FROM adoptopenjdk:8-openj9
 
# 更新软件
RUN apt-get update; \
    apt-get install -y --no-install-recommends \
        net-tools \
    ; \
    rm -rf /var/lib/apt/lists/*
 
# 设置时区
RUN echo "Asia/Shanghai" > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
————————

Dockerfile

FROM openjdk:8-jdk-alpine

COPY ./STSONG.TTF /usr/share/fonts/
COPY ./arthas.zip /tmp/

ENV TZ=Asia/Shanghai

ENV LANG=zh_CN.UTF-8

RUN apk --no-cache add tzdata msttcorefonts-installer ttf-dejavu curl tini fontconfig && \
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    echo "Asia/Shanghai" > /etc/timezone && \
    update-ms-fonts && \
    fc-cache -vf && \
    mkdir /usr/local/arthas && \
    unzip /tmp/arthas.zip -d /usr/local/arthas && \
    rm -rf /tmp/arthas.zip
#   apk del tzdata
官方的java镜像满足不了要求,通常需要对其进行扩展,安装必要的软件等。
 
现就工作中常用到的java镜像Docker进行备份,以备后用
 
openjdk
 
# docker build -t java8:jdk-openjdk .
FROM openjdk:8
 
# 修改源
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
 
# 增加常用软件
RUN apt-get update; \
    apt-get install -y --no-install-recommends \
        net-tools \
    ; \
    rm -rf /var/lib/apt/lists/*
 
# 设置时区
RUN echo "Asia/Shanghai" > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 
 
amazoncorretto
 
# docker build -t java8:jdk-aws .
FROM amazoncorretto:8
 
# 增加常用软件
RUN yum install -y procps && yum install -y net-tools && yum clean all
 
# 设置时区
RUN echo "Asia/Shanghai" > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 
openj9
 
# docker build -t java8:jdk-openj9 .
FROM adoptopenjdk:8-openj9
 
# 更新软件
RUN apt-get update; \
    apt-get install -y --no-install-recommends \
        net-tools \
    ; \
    rm -rf /var/lib/apt/lists/*
 
# 设置时区
RUN echo "Asia/Shanghai" > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime