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 ~]#
直接到仓库上查看数据