DockerFile 地址  https://github.com/m15140482647/docker-php-web.git

基于docker 构建php + nginx + mysql + redis的web环境

版本:

PHP 7.2 redis swoole 扩展

Mysql 5.6

openresty 1.11.2.3

安装文件:

docker-compose.yaml 

version: '2'

services:
  cgi:
    container_name: php7.2
    image: reader1/php_ext_redis_swoole:7.2
    restart: always 
    expose:
      - "9000"
    ports:
      - "9000:9000"
    volumes:
      - ../myspace:/www/workspace/
    depends_on:
      - mysql
      - redis
    links:
      - mysql:mysql
      - redis:redis
  nginx:
    container_name: nginx_v1
    image: reader1/openresty:1
    restart: always
    volumes: 
      - ./config/nginx:/etc/nginx/conf.d
      - ./logs/nginx:/var/log/nginx
      - ../myspace:/www/workspace/:ro
    ports: 
      - 80:80
      - 443:443
  mysql:
    container_name: mysql
    image: daocloud.io/library/mysql:5.6
    restart: always
    expose:
      - "3306"
    ports:
      - "3306:3306"
    volumes:
      - ./runtime/var_lib_mysql:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=zydc
  redis:
    container_name: redis
    image: daocloud.io/library/redis
    restart: always
    expose:
      - "6379"
    ports:
      - "6379:6379"
    volumes:
      - ./runtime/var_lib_redis:/data
    command: redis-server --appendonly yes

使用方法

安装docker

Ubuntu Docker 安装 | 菜鸟教程

安装docker-compose

Docker Compose | 菜鸟教程

安装yaml 执行安装命令

docker-compose up -d

DONE !!!

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐