zhanghong 发表于 2019-2-20 08:12:51

docker与jenkins的自动化CI/CD流水线实战(php

环境需求
https://s1.运维网.com/images/blog/201901/03/a7f40b4eb3e368f6a7034ba0f8a313fc.png
编写dockerfile
  备注:内容太长,写在自己的电脑上了
流程:
1、yum安装基础服务,如gcc,make,openssl
2、nginx1.14.0安装
3、php-7.1.19安装
4、supervisord监听nginx,php服务
5、#docker防止中文乱码
6、安装crontabs 服务
echo "/1 * bash /data/shell/check_supervisord.sh >> /root/check_supervisord.log" >> /var/spool/cron/root
7、必须 要将crond给自启动,不然进入容器还是不执行
RUN systemctl enable crond
build
https://s1.运维网.com/images/blog/201901/03/a6d21e500bce85b43f2511a958a16138.png
  docker build -t 192.168.1.232/library/nginx-php:v1.14_v7.1.19 -f Dockerfile-nginx-php .
docker_run
  docker run --privileged -itd --name php-test4--mount type=bind,src=/data/www,dst=/data/www --mount type=bind,src=/mnt,dst=/mnt -p 801:80 192.168.1.232/library/nginx-php:v1.14_v7.1.19
  查看:docker ps -l
进入容器:ps -ef 看是否正常启动
  错误:
# systemctl start supervisord         
Failed to get D-Bus connection: Operation not permitted
  解决:
docker run --privileged -itd --name php-test4--mount type=bind,src=/data/www,dst=/data/www --mount type=bind,src=/mnt,dst=/mnt -p 801:80 192.168.1.232/library/nginx-php:v1.14_v7.1.19
  错误:
为什么创建容器,不执行crontab -l的内容呢
  解决:dockerfile 时需要将systemctl enable crond 开机启动



页: [1]
查看完整版本: docker与jenkins的自动化CI/CD流水线实战(php