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
