创建一个httpd的目录。在httpd的目录下面创建一个files目录放三个安装包。
[root@localhost ~]# mkdir httpd
[root@localhost ~]# cd htt
httod.tar httpd/ httpd-2.4.54.tar.gz
[root@localhost ~]# cd htt
httod.tar httpd/ httpd-2.4.54.tar.gz
[root@localhost ~]# cd httpd/
[root@localhost httpd]# mkdir files
[root@localhost httpd]# cd
[root@localhost ~]# mv apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.54.tar.g z httpd/files/
[root@localhost ~]# cd httpd/
[root@localhost httpd]# ls
files
[root@localhost httpd]# ls files/
apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz
写dockerfile配置文件
[root@localhost httpd]# vim Dockerfile
[root@localhost httpd]# cat Dockerfile
FROM centos
LABEL MAINTAINER "SHU 2228706561@qq.com"
EXPOSE 80 443
ADD files/* /usr/src/
RUN useradd -r -M -s /sbin/nologin apache && \
rm -rf /etc/yum.repos.d/* && \
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.
yum clean all && \
yum -y install openssl-devel pcre-devel expat-devel libtool make gcc gcc-c++ && \
cd /usr/src/apr-1.7.0 && \
./configure --prefix=/usr/local/apr && \
make && \
make install && \
cd && \
cd /usr/src/apr-util-1.6.1/ && \
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && \
make && \
make install && \
cd && \
cd /usr/src/httpd-2.4.54/ && \
./configure --prefix=/usr/local/apache --enable-so --enable-ssl --enable-cgi --enable-rewrite --witth-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enabled=all --with-mpm=prefork && \
make && \
make install
WORKDIR /usr/local/apache
CMD ["-D","FOREGROUND"]
ENTRYPOINT ["/usr/local/apache/bin/httpd"]
运行
[root@localhost httpd]# podman build -t httpd:2002.17 .
STEP 1/8: FROM centos
STEP 2/8: LABEL MAINTAINER "SHU 2228706561@qq.com"
--> c1b0016a53e
STEP 3/8: EXPOSE 80 443
--> bd33d46d669
STEP 4/8: ADD files/* /usr/src/
--> a48563efd9d
STEP 5/8: RUN useradd -r -M -s /sbin/nologin apache && rm -rf /etc/yum.repos.d/* && curl -o /etc/yumntOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo && sed -i -e '/mirrors.clo.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo && yum clean all && yum -y issl-devel pcre-devel expat-devel libtool make gcc gcc-c++ && cd /usr/src/apr-1.7.0 && ./configure --/local/apr && make && make install && cd && cd /usr/src/apr-util-1.6.1/ && ./configure --prefix=/usrutil --with-apr=/usr/local/apr && make && make install && cd && cd /usr/src/httpd-2.4.54/ && ./confiix=/usr/local/apache --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all prefork && make && make install
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2495 100 2495 0 0 3886 0 --:--:-- --:--:-- --:--:-- 3886
.......
[root@localhost httpd]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/httpd 2002.17 011654610dfc 15 seconds ago 705 MB
localhost/ub latest 8b43ab34c7e4 23 hours ago 1.09 kB
<none> <none> d852b2ec6dc2 23 hours ago 1.09 kB
<none> <none> cae8327971d3 23 hours ago 1.09 kB
<none> <none> 42ff5a1f99ac 23 hours ago 1.09 kB

上传到官方仓库
[root@localhost httpd]# podman tag httpd:2002.17 shujiaming/s1:2002.17
[root@localhost httpd]# podman push shujiaming/s1:2002.17
Getting image source signatures
Copying blob 69e2d3c37a01 done
Copying blob 2653d992f4ef done
Copying blob 1eb6435c5f60 done
Copying config 011654610d done
Writing manifest to image destination
Storing signatures
