创建docker build目录

mkdir http_php72 && cd http_php72

创建容器启动脚本run.sh

cat > run.sh << EOF
#!/bin/bash
httpd -k start
while true; do sleep 30; done;
EOF
chmod +x run.sh

创建dockerfile

cat > Dockerfile << EOF
FROM centos
MAINTAINER 2542796898@qq.com
RUN yum install epel-release -y && rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm && yum install -y vim httpd php72w php72w-cli php72w-common php72w-devel php72w-gd php72w-pdo php72w-mysql php72w-mbstring php72w-bcmath php72w-redis php72w-ssl
ADD run.sh /
CMD ["/run.sh"]
EOF

构建容器镜像

docker build -t registry.cn-shenzhen.aliyuncs.com/maxbon/http_php72:v1.0 .

连接阿里云私有仓库

docker login --username=maxbon registry.cn-shenzhen.aliyuncs.com

push镜像

docker push registry.cn-shenzhen.aliyuncs.com/maxbon/http_php72:v1.0