侧边栏壁纸
  • 累计撰写 176 篇文章
  • 累计创建 87 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录

Dockerfile构建apache+php7.2容器镜像并push到阿里云私有仓库

Z先森
2019-09-28 / 0 评论 / 0 点赞 / 15 阅读 / 0 字 / 正在检测是否收录...

创建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
0

评论区