Dockfile自动创建discuz论坛和可道云
2024-10-19 22:24:10
将discuz论坛的zip包解压之后用tar包压缩,这样ADD可以直接解压tar包。
[root@localhost centos6.9_ssh_discuz]# pwd /opt/dockerfile/centos6.9_ssh_discuz [root@localhost centos6.9_ssh_discuz]# ls default.conf discuz.tar.gz Discuz_X3.4_SC_UTF8_0802.zip dockerfile init.sh、 [root@localhost centos6.9_ssh_discuz]# cat default.conf server { listen 80 ; server_name localhost; root /code; index index.php index.html index.htm; location / { } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /code$fastcgi_script_name; include fastcgi_params; } } [root@localhost centos6.9_ssh_discuz]# cat init.sh #!/bin/bash service nginx start service php-fpm start service mysqld start /usr/sbin/sshd -D [root@localhost centos6.9_ssh_discuz]# cat dockerfile FROM centos:6.9 RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo && \ curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo && \ yum install openssh-server nginx php-fpm php-gd php-pecl-zendopcache php-mysqli mysql-server -y && \ service sshd start && \ echo "123456"|passwd --stdin root ADD default.conf /etc/nginx/conf.d/default.conf RUN mkdir /code WORKDIR /code ADD discuz.tar.gz . RUN chmod -R 777 . && \ mv upload/* . && \ service mysqld start && \ mysqladmin -uroot password '123456' EXPOSE 22 80 ADD init.sh /init.sh CMD ["/bin/bash","/init.sh"] 启动容器: docker run -d -p 80:80 discuz:v1
打开网页测试:
可道云:
[root@localhost centos6.9_ssh_kode]# pwd /opt/dockerfile/centos6.9_ssh_kode [root@localhost centos6.9_ssh_kode]# ls dockerfile init.sh kode.tar.gz nginx.conf [root@localhost centos6.9_ssh_kode]# cat dockerfile FROM centos:6.9 RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo && \ curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo && \ yum install nginx php-mbstring php-fpm php-gd -y ADD nginx.conf /etc/nginx/nginx.conf RUN mkdir /code WORKDIR /code ADD kode.tar.gz . RUN chown -R apache.apache . RUN chown -R apache.apache /var/lib/nginx EXPOSE ADD init.sh /init.sh CMD ["/bin/bash","/init.sh"] [root@localhost centos6.9_ssh_kode]# cat init.sh #!/bin/bash service php-fpm start nginx -g 'daemon off;' [root@localhost centos6.9_ssh_kode]# cat nginx.conf events { worker_connections ; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout ; server { listen ; server_name localhost; root /code; index index.php index.html index.htm; location / { } location ~ \.php$ { root html; fastcgi_pass ; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /code$fastcgi_script_name; include fastcgi_params; } } } [root@localhost centos6.9_ssh_kode]# docker build --network=host -t kode:v2 . 10b8fcc6a31760c8f3982ab539640aca48c7054f904ce5266bee69d5c1b1e680 [root@localhost centos6.9_ssh_kode]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 10b8fcc6a317 kode:v2 seconds ago Up seconds ->/tcp unruffled_dewdney [root@localhost centos6.9_ssh_kode]# docker run -d -p : kode:v2
页面测试:
最新文章
- 关于smarty的一些个人笔记
- JNI ReferenceTable overflow
- ucgui
- openstack排错
- 2013 ACM-ICPC长沙赛区全国邀请赛—Special equations
- FMDB的一些基本操作小结
- ListView在异步加载动态图片时,往往最后一项或几项被遮盖(IM场景居多)
- springmvc环境下使用ajaxfileupload.js进行文件上传
- ASP.NET Core 实战:使用 ASP.NET Core Web API 和 Vue.js 搭建前后端分离项目
- AOP 还在配置吗改用打标签模式吧!
- 关于Javascript中页面动态钟表的简单实现
- Revit 命令添加下拉框
- ASP.NET Core 2.1 使用Docker运行
- 10张图带你深入理解Docker容器和镜像
- metamascara学习导论
- Algorithm 算法基础知识(未完成
- python学习之----导航树
- MD5加密和彩虹表
- ADO.NET系列之事务和调用存储过程
- Flask 入门一( flask 框架和 flask-script 库)
热门文章
- 吴裕雄--天生自然 PYTHON3开发学习:字符串
- 项目在eclipse中正常,在idea中报错
- SQL:找到特定日期每个顾客最高购买量:Find the highest purchase amount ordered by the each customer on a particular date, with their ID, order date and highest purchase amount.
- Activity组件(二):通过显式意图和隐式意图来跳转至第三方应用
- 20190221 beautiful soup 入门
- linux 下删除乱码的文件夹
- [Algo] 306. Check If Linked List Is Palindrome
- BTree
- Linux mint OS
- BaseAdapter教程(1) 最简单地使用BaseAdapter