fpm、redis、nginx、mysql容器docker-compose启动配置参考

  • fpm
version: "3"
services:
    php-fpm:
        container_name: php-fpm
        image: php:7.3-fpm-alpine
        user: www-data
        network_mode: "host"
        restart: always
        working_dir: /app
        volumes:
          - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
          - /opt/test:/app/test
  • redis
version: "3"
services:
  redis:
    container_name: redis
    image: redis:5-alpine
    user: root
    network_mode: "host"
    volumes:
      - ./database:/data
      - ./redis.conf:/usr/local/etc/redis/redis.conf
    command: redis-server /usr/local/etc/redis/redis.conf
  • nginx
version: "3"
services:
  nginx:
    container_name: nginx
    image: nginx:1.16-alpine
    restart: always
    network_mode: "host"
    environment:
      - "USER=www"
    volumes:
      - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
      - /opt/test:/app/test
      - /opt/bll-doc:/app/bll-doc
      - ./conf.d:/etc/nginx/conf.d
      - ./nginx.conf:/etc/nginx/nginx.conf
      - ./logs:/var/log/nginx
  • mysql
version: "3"
services:
  mysql:
    container_name: mysql
    image: mysql:8
    #restart: always
    environment:
      MYSQL_ROOT_HOST: '%'
      MYSQL_ROOT_PASSWORD: 'middlewarepwd'
    network_mode: "host"
    volumes:
      - ./mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf
      - ./database:/var/lib/mysql
    command: --default-authentication-plugin=mysql_native_password

你可能感兴趣的:(fpm、redis、nginx、mysql容器docker-compose启动配置参考)