docker與jenkins的自動化CI/CD流水線實戰(php-svn)

環境需求

docker與jenkins的自動化CI/CD流水線實戰(php-svn)

編寫dockerfile

備註:內容太長,寫在本身的電腦上了
流程:
一、yum安裝基礎服務,如gcc,make,openssl
二、nginx1.14.0安裝
三、php-7.1.19安裝
四、supervisord監聽nginx,php服務
五、#docker防止中文亂碼
六、安裝crontabs 服務
echo "/1 * bash /data/shell/check_supervisord.sh >> /root/check_supervisord.log" >> /var/spool/cron/root
七、必須 要將crond給自啓動,否則進入容器仍是不執行
RUN systemctl enable crondphp

build

docker與jenkins的自動化CI/CD流水線實戰(php-svn)

docker build -t 192.168.1.232/library/nginx-php:v1.14_v7.1.19 -f Dockerfile-nginx-php .nginx

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

查看:docker ps -l
進入容器:ps -ef 看是否正常啓動shell

錯誤:
[root@b78ec7459ebb php-7.1.19]# systemctl start supervisord
Failed to get D-Bus connection: Operation not permittedbash

解決:
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 ide

錯誤:
爲何建立容器,不執行crontab -l的內容呢svn

解決:dockerfile 時須要將systemctl enable crond 開機啓動ui

相關文章
相關標籤/搜索