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


代码下载

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐