Dockerfile使用基于alpine镜像上传本地仓库

alpine系统
dockerfile配置文件写入

[root@192 httpd]# cat Dockerfile 
FROM alpine

LABEL MANTAINER "sean sean1002@126"
ENV apache_version 2.4.54
ENV PATH /usr/local/apache/bin:$PATH

ADD files/* /tmp/

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
    apk update && \
    apk add --no-cache -U gcc libc-dev make expat-dev pcre-dev openssl-dev libtool && \
    adduser -SHs /sbin/nologin apache && \
    cd /tmp/apr-1.7.0/ && \
    sed -i '/$RM "$cfgfile"/d' configure && \
    ./configure --prefix=/usr/local/apr && \
    make && make instal && \
    cd ../apr-util-1.6.1/ && \
    ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && \
    make && make install && \
    cd ../httpd-${apache_version} && \
    ./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 && \
    mv /tmp/entrypoint.sh / && \
    apk del gcc make && \
    rm -rf /tmp/* /usr/src/*

EXPOSE 80
WORKDIR /usr/local/apache
CMD ["/usr/local/apache/bin/httpd","-D","FOREGROUND"]
ENTRYPOINT ["/entrypoint.sh"]

[root@192 httpd]# 

脚本文件

#!/bin/bash

sed -i '/^#ServerName/s/#//g' /usr/local/apache/conf/httpd.conf

exec "$@"

[root@192 files]# 


查看并上传镜像

[root@192 httpd]# docker build -t httpd:v486
...
...
---> 2150018a2c19
Successfully built 2150018a2c19
Successfully tagged httpd:v486

....

[root@192 ~]# docker images
REPOSITORY           TAG       IMAGE ID       CREATED          SIZE
0b8d572d1c7d/httpd   v486      2150018a2c19   11 minutes ago   122MB


[root@192 ~]# docker push 0b8d572d1c7d/httpd:v486
The push refers to repository [docker.io/0b8d572d1c7d/httpd]
44329628db61: Layer already exists 
9b556c7214a0: Layer already exists 
8d3ac3489996: Layer already exists 
v486: digest: sha256:e39a733b6f7a1ca6306e1d5580b5b35ebc447fae62294180efb93c219edcf58e size: 952
[root@192 ~]# 

直接到仓库上查看数据
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值