Dockerfile安装apache镜像

apache镜像

[root@localhost files]# ls
apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.51.tar.gz
[root@localhost apache]# cat Dockerfile 
FROM centos

LABEL WAINTAINER='mkf@163.com'

ADD /apache/files/* /usr/local

WORKDIR /usr/local/

ENV PATH /usr/local/apache/bin:$PATH

RUN yum -y install openssl-devel pcre-devel pcre expat-devel libtool gcc gcc-c++ make which && \
    cd apr-1.7.0 && sed -i '/$RM "$cfgfile"/d' configure && \
    ./configure --prefix=/usr/local/apr && make && make install && \
    cd ../apr-util-1.6.1 && \
    ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && \
    make && make install && \
    cd ../httpd-2.4.51 && \
    ./configure --prefix=/usr/local/apache \
      --enable-so \
      --enable-ssl \
      --enable-cgi \
      --enable-rewrite \
      --with-zlib \
      --with-pcre \
      --with-apr=/usr/local/apr \
      --with-apr-util=/usr/local/apr-util/ \
      --enable-modules=most \
      --enable-mpms-shared=all \
      --with-mpm=prefork && make && make install

EXPOSE 80

VOLUME ["/usr/local/apache/htdocs/"]

CMD ["/usr/local/apache/bin/apachectl","-D","FOREGROUND"]
// 制作镜像
[root@localhost ~]# docker build -t httpd:v0.1  /root/httpd/

// 基于新镜像创建容器
[root@localhost ~]# docker run  --name httpd -dit -p 80:80 512153770/httpd:v0.1

// 上传镜像仓库
[root@localhost ~]# docker login
Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

[root@localhost ~]# docker push 512153770/httpd:v0.1
The push refers to repository [docker.io/512153770/httpd]
dadafddf7e77: Pushed 
gdzd8e5caf37: Pushed 
1gsafsafsafa: Layer already exists 
v0.1: digest: sha256:26234cdfd55de2cd1b87f796661535d6c97e6b837c03cb1390efe01a43cca342 size: 954

请添加图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值