linux运维之Dockerfile(构建php项目《可道云》)

2019-12-10  本文已影响0人  你好树洞先生

制作一个Kodexplorer网盘docker镜像。nginx + php-frm

1.手动构建一遍(同上篇dockerfile文章)

2.编写dockerfile

[root@docker01 kod]# cat dockerfile

FROM centos6.9_nginx:v1

RUN echo "192.168.37.200 mirrors.aliyun.com" >>/etc/hosts

RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

RUN curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

RUN yum install nginx php-fpm php-gd php-mbstring unzip -y

ADD www.conf /etc/php-fpm.d/www.conf

RUN rm -f /etc/nginx/conf.d/*

ADD kod.conf /etc/nginx/conf.d/kod.conf

ADD init.sh /init.sh

RUN mkdir /html

WORKDIR /html

RUN curl -o  kod.zip http://192.168.37.200/191127/kodexplorer4.40.zip

RUN unzip kod.zip

RUN chown -R nginx:nginx /html

EXPOSE 80

CMD ["/bin/bash","/init.sh"]

[root@docker01 kod]# vi init.sh

#!/bin/bash

  service php-fpm start

  nginx -g 'daemon off;'

3.构建镜像

docker build -t kod:v1

4.测试

docker run -d -p 88:80 kod:v1

docker ps -a -l

docker logs 311acf155266

上一篇 下一篇

猜你喜欢

热点阅读