构建 jdk8/tomcat8 镜像

发布时间: 更新时间: 总字数:316 阅读时间:1m 作者: 分享

Java+Tomcat是进程常使用的Java Web服务器,该博文主要如何使用Dockerfile构建Docker镜像

Dockerfile

# Create by Xie Xianbin, For centos7 jdk image
# v 1.0.0

# base image
FROM xiexianbin/centos7:latest

# remark
MAINTAINER Xie Xianbin "xianbinxie@163.com"

# Dockerfile build cache
ENV REFRESHED_AT 2016-07-29

RUN rm -rf /etc/yum.repos.d/*
COPY Centos-7.repo /etc/yum.repos.d/
RUN yum clean all
RUN yum -y install wget curl vim tar
COPY apache-tomcat-8.5.4.tar.gz /opt/
COPY jdk-8u101-linux-x64.rpm /opt/

RUN rpm -ivh /opt/jdk-8u101-linux-x64.rpm
RUN tar -zxf /opt/apache-tomcat-8.5.4.tar.gz -C /opt/

RUN rm -rf /opt/jdk-7u79-linux-x64.rpm
RUN echo "sh /opt/apache-tomcat-8.5.4/bin/startup.sh" >> /etc/rc.local
RUN rm -rf /opt/apache-tomcat-8.5.4/webapps/docs
RUN rm -rf /opt/apache-tomcat-8.5.4/webapps/examples
RUN rm -rf /opt/apache-tomcat-8.5.4/webapps/host-manager
RUN rm -rf /opt/apache-tomcat-8.5.4/webapps/manager

RUN yum clean all
RUN history -c

EXPOSE 8080
ENTRYPOINT ["/bin/bash"]

Dockerfile 目录文件详情

Docker相关文件下载地址:[链接: http://pan.baidu.com/s/1i5M22pv][dockerfile]

[dockerfile]:链接: http://pan.baidu.com/s/1i5M22pv 密码: 2puc

Docker build 命令

docker build -t xiexianbin/centos7:j8t8 .

docker build 过程

[root@xiexianbin_cn docker]# docker build -t xiexianbin/centos7:j8t8 .
Sending build context to Docker daemon 175.2 MB
Sending build context to Docker daemon
Step 0 : FROM xiexianbin/centos7:latest
  ---> 8c2683e1bd97
Step 1 : MAINTAINER Xie Xianbin "xianbinxie@163.com"
  ---> Running in 9edb67344021
  ---> 87315882baef
...
Removing intermediate container 818f799b659b
Step 20 : ENTRYPOINT /bin/bash
  ---> Running in 0dc1fd834f39
  ---> c901722935c4
Removing intermediate container 0dc1fd834f39
Successfully built c901722935c4
[root@xiexianbin_cn docker]#

登录Docker Hub

[root@xiexianbin_cn ~]# docker login
Username: xiexianbin
Password:
Email: me@xiexianbin.cn
WARNING: login credentials saved in /root/.dockercfg.
Login Succeeded
[root@xiexianbin_cn ~]#
最新评论
加载中...
Home Archives Categories Tags