栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

使用docker搭建适合thinkphp5的lnmp+redis开发环境

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用docker搭建适合thinkphp5的lnmp+redis开发环境

nginx版本为最新版本
php版本为7.3
mysql版本为5.7
redis版本为5.0

启动效果如下:

mysql连接打开如下:

thinkphp5的代码放到html目录下面了

在html目录下面执行composer update下载第三方开发包

[root@localhost html]# composer update
PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library) 'mysqlnd' in Unknown on line 0
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? 
Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
  - Locking topthink/framework (v5.0.24)
  - Locking topthink/think-installer (v1.0.14)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Downloading topthink/think-installer (v1.0.14)
  - Downloading topthink/framework (v5.0.24)
  - Installing topthink/think-installer (v1.0.14): Extracting archive
  - Installing topthink/framework (v5.0.24): Extracting archive
Generating autoload files

docker-compose.yml文件配置如下:

version: '3'

services:
  nginx:
    build: nginx/
    container_name: nginx
    ports: 
    - 80:80
    volumes: 
    - ./html:/var/www/html
    - ./nginx/nginx.conf:/etc/nginx/nginx.conf
    - ./nginx/conf/conf.d:/etc/nginx/conf.d
    networks: 
      nw:
        ipv4_address: 192.168.0.2
  php:
    build: php/
    container_name: php
    volumes: 
    - ./html:/var/www/html
    networks:
      nw:
        ipv4_address: 192.168.0.3
  mysql:
    image: "mysql:5.7"
    container_name: mysql
    volumes:
    - ./mysql/data:/var/lib/mysql
    environment:
    - MYSQL_ROOT_PASSWORD=root
    networks:
      nw:
        ipv4_address: 192.168.0.4
  redis:
    image: "redis:5"
    container_name: redis
    ports:
    - 6379:6379
    volumes:
    - ./redis5/conf:/usr/local/etc/redis
    - ./redis5/data:/data
    environment:
    - TZ=Asia/shanghai
    networks:
      nw:
        ipv4_address: 192.168.0.5
networks:
  nw:
    driver: bridge
    ipam:
      driver: default
      config:
      - subnet: 192.168.0.0/16

执行docker-compose up -d ,启动容器

[root@localhost lnmp]# docker-compose up -d
Creating network "lnmp_nw" with driver "bridge"
Creating redis ... done
Creating mysql ... done
Creating nginx ... done
Creating php   ... done


代码下载

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/831284.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号