构建 jdk7/tomcat7 镜像

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

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

Dockerfile

Dockerfile
# Create by Xie Xianbin, For nginx Dockerfile
# v 0.0.1

# base image
FROM xiexianbin/centos6:base

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

# Dockerfile build cache
ENV REFRESHED_AT 2015-08-02

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

RUN rpm -ivh /opt/jdk-7u79-linux-x64.rpm
RUN tar -zxf /opt/apache-tomcat-7.0.63.tar.gz -C /opt/

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

RUN yum clean all
RUN history -c

EXPOSE 8080
ENTRYPOINT ["/bin/bash"]

Dockerfile 目录文件详情

相关文件下载地址

Docker build 命令

docker build -t xiexianbin/centos6:j7t7 .

docker build 过程

docker-build
$ docker build -t xiexianbin/centos6:j7t7 .
Sending build context to Docker daemon 146.9 MB
Sending build context to Docker daemon
Step 0 : FROM xiexianbin/centos6:base
  ---> a441d723c250
Step 1 : MAINTAINER Xie Xianbin "xianbinxie@163.com"
  ---> Running in bbe8641d7e60
  ---> 071e4124082c
Removing intermediate container bbe8641d7e60
Step 2 : ENV REFRESHED_AT 2015-08-09
  ---> Running in 000882f3c225
  ---> 42eff22932cf
...
Step 20 : ENTRYPOINT /bin/bash
---> Running in 451357081dde
---> 07ce97ebf5a7
Removing intermediate container 451357081dde
Successfully built 07ce97ebf5a7

登录Docker Hub

[root@iZ288u02izdZ ~]# docker login
Username: xiexianbin
Password:
Email: me@xiexianbin.cn
WARNING: login credentials saved in /root/.dockercfg.
Login Succeeded
[root@iZ288u02izdZ ~]#

docker push

docker login
docker push xiexianbin/centos6:j7t7
最新评论
加载中...
Home Archives Categories Tags