基于alpine镜像,创建NGINX
cat Dockerfile
FROM alpine:latest MAINTAINER yayaw me@yayaw.com RUN echo -e "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.5/main\n\ https://mirror.tuna.tsinghua.edu.cn/alpine/v3.5/community" > /etc/apk/repositories # install nginx RUN apk add --no-cache python nginx tzdata python py2-pip RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime EXPOSE 80 RUN mkdir /run/nginx CMD ["nginx", "-g", "daemon off;"]
———————————————————————————————————————————————————————————————————————
FROM alpine:latest MAINTAINER yayaw me@yayaw.com RUN echo -e "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.5/main\n\ https://mirror.tuna.tsinghua.edu.cn/alpine/v3.5/community" > /etc/apk/repositories # install nginx RUN apk add --update --no-cache tzdata build-base zlib-dev pcre-dev && rm -rf /var/cache/apk/* RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime RUN wget http://nginx.org/download/nginx-1.10.3.tar.gz && tar zxf nginx-1.10.3.tar.gz && cd nginx-1.10.3 && ./configure --prefix=/opt/nginx && make && make install RUN apk del build-base RUN cd .. && rm -rf nginx-1.10.3* EXPOSE 80 CMD ["/opt/nginx/sbin/nginx", "-g", "daemon off;"]
基于上面的编译完成后的
FROM alpine:latest MAINTAINER yayaw me@yayaw.com RUN echo -e "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.5/main\n\ https://mirror.tuna.tsinghua.edu.cn/alpine/v3.5/community" > /etc/apk/repositories # install nginx RUN apk add --update --no-cache tzdata zlib-dev pcre-dev && rm -rf /var/cache/apk/* RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ADD ./nginx /opt EXPOSE 80 CMD ["/opt/nginx/sbin/nginx", "-g", "daemon off;"]
———————————————————————————————————————————————————————————————————————
基于alpine镜像,创建TOMCAT,安装自带的JDK,会出现验证不显的问题,但体积比较小88M
FROM alpine:latest MAINTAINER yayaw me@yayaw.com RUN echo -e "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.5/main\n\ https://mirror.tuna.tsinghua.edu.cn/alpine/v3.5/community" > /etc/apk/repositories # install tomcat9+jdk8 RUN apk add --update openjdk8-jre-base RUN apk add --update tzdata RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime ADD ./java /opt EXPOSE 8080 ENTRYPOINT ["/opt/tomcat1/bin/catalina.sh", "run"]
基于alpine镜像,创建TOMCAT,安装SUN的JDK,体积较大,160M
FROM alpine:latest MAINTAINER cSphere < docker@csphere.cn > RUN echo -e "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.5/main\n\ https://mirror.tuna.tsinghua.edu.cn/alpine/v3.5/community" > /etc/apk/repositories RUN apk add --update tzdata RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime WORKDIR /opt ADD ./key /etc/apk/keys/ ADD ./java /opt RUN apk add glibc-2.25-r0.apk glibc-bin-2.25-r0.apk glibc-i18n-2.25-r0.apk RUN rm *.apk #ENV JAVA_HOME=/opt/jdk8 #ENV PATH=${PATH}:${JAVA_HOME}/bin #CMD /opt/tomcat1/bin/startup.sh && tail -f /opt/tomcat1/logs/catalina.out ENTRYPOINT ["/opt/tomcat1/bin/catalina.sh", "run"]