系统环境为centos7,使用docker 搭建centos7容器环境,安装php7.1.13
cd;
mkdir docker;
cd docker;
mkdier php71;
cd php71;
vim Dockerfile;
把内容添加进去,建议使用set paste命令消除黏贴格式:
< 内容 begin >
FROM centos:7
MAINTAINER yanjt@gcbidding.com
# 安装系统基础库
RUN yum update -y
RUN yum install -y yum-utils
# 安装apache php
RUN yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN yum-config-manager --enable remi remi-php71
RUN yum makecache -y
RUN yum install -y httpd php php-gd php-mcrypt php-mbstring php-xml php-json php-mysqlnd php-pdo-mysql php-pecl-redis
#设置支持rewrite
RUN sed -i '151s/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
# 配置php.ini
RUN sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 20M/g' /etc/php.ini
RUN sed -i 's/post_max_size = 8M/post_max_size = 20M/g' /etc/php.ini
RUN sed -i 's/;date.timezone =/date.timezone = Asia\/Shanghai/g' /etc/php.ini
EXPOSE 80/tcp
ENTRYPOINT /usr/sbin/httpd -DFOREGROUND
< 内容 end >
:wq 推出编辑
docker build -t php71:1.0 ./
docker run --name bigdataplateform -d -p 10002:80 -p 20023:22 -v /var/www/html:/var/www/html -v /data/logs/test.bigdataplatform:/var/log/httpd -v /tmp:/tmp --restart always php71:1.0 创建容器
php7.1环境搭建完成