win10中 hyper-v 中搭建 docker 快速搭建一个thinkphp6 的项目 swoole 环境 websocket 示例代码

1. 先安装docker  和docker-composer 

  1.1安装docker 直接使用快捷一键安装

$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh --mirror Aliyun

  1.2等待一分钟docker安装完成启动docker 

$ sudo systemctl enable docker
$ sudo systemctl start docker

   1.3 测试docker 安装 和镜像加速

   直接参考文章安装和调试  CentOS 安装 Docker | Docker 从入门到实践

2.安装php 运行环境

  2.1   选用最简单 的拥有 php-fpm 和 nginx 的 镜像 webdevops/php-nginx   webdevops/php-nginx — Dockerfile Documentation documentation  直接使用 docker pull 拉取最新镜像 

docker pull webdevops/php-nginx 

  2.2 拉完了之后docker images  查看镜像文件是否成功

docker images 

  显示如下就说明pull 下来了

 

2.3 运行下webdevops/php-nginx的镜像文件 

docker run -itd --name php-ngins-thinkphp6 -p 89:80 -v /home/guyi/www/thinkphp6/:/app/ webdevops/php-nginx  

-itd    交互终端方式打开具体参数解读可阅读该篇文章 docker run参数详解_docker run 参数详解_日日行不惧千万里的博客-优快云博客

--name  给容器取一个名字

-p    89 :就是虚拟机可以访问的端口(后面 ip:89 就可以访问)   80是容器里面的80端口 

-v    /home/guyi/www/thinkphp6/ 虚拟机目录映射的目录(指向放项目的目录即可)     /app/ 虚拟机          的容器路径。 还可增加 配置文件目录 修改配置文件的时候就无须进入容器修改:   -v  nginx 的        配置目录/conf.d : /opt/docker/etc/nginx/conf.d    其他挂载配置路径看下表

容器内php 配置文件路径     

File/Directory Description
/opt/docker/etc/php/php.webdevops.ini PHP settings from WebDevOps image
/opt/docker/etc/php/php.ini  php.ini for custom settings
/opt/docker/etc/php/fpm/php-fpm.conf PHP-FPM main configuration file
/opt/docker/etc/php/fpm/pool.d/application.conf Application PHP-FPM pool configuration file
/opt/docker/etc/supervisor.d/php-fpm.conf Supervisord configuration file for PHP-FPM

 容器内nginx 配置路径

File/Directory Description
/opt/docker/etc/nginx/conf.d 

Main global configuration directory

(automatically included files)

/opt/docker/etc/nginx/conf.d/10-php.conf PHP cgi configuration
/opt/docker/etc/nginx/ssl

SSL configuration directory for

certifications and keys

/opt/docker/etc/nginx/ssl/server.crt  Example SSL certification (
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值