Docker workerman


https://store.docker.com/community/images/kolyadin/workerman/dockerfile

启动 workerman

docker-compose.exe run -d workerman php start.php start

在 web 引入外部网络 workerman

version: '3'
services:
  web:
    image: nginx:stable
    ports:
      - 443:443
    volumes:
      - ./nginx:/etc/nginx
      - ./www:/var/www/html
      - ./logs/nginx:/var/log/nginx
    restart: always
    external_links:
      - workerman_app:workerman
    networks:
      - overlay
  php5.6:
     image: wodby/drupal-php:5.6
     expose:
       - 9000
     networks:
       - overlay
     volumes:
       - ./www:/var/www/html
  php7.0:
     image: wodby/drupal-php:7.0
     expose:
       - 9000
     networks:
       - overlay
     volumes:
       - ./www:/var/www/html
  php7.1:
     image: wodby/drupal-php:7.1
     expose:
       - 9000
     networks:
       - overlay
     volumes:
       - ./www:/var/www/html
  mysql5.7:
    image: mysql:5.7
    restart: always
    expose:
      - 3306
    volumes:
      - ./configs/mysql5.7/config/:/etc/mysql/mysql.conf.d/
      - ./db/mysql5.7:/var/lib/mysql
      - ./logs/mysql5.7:/var/log/mysql/
    networks:
      - overlay
  redis:
    image: redis
    networks:
      - overlay
networks:
  overlay:

在 nginx 配置中使用

location /socket {
    proxy_pass http://workerman:6789;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header X-Real-IP $remote_addr;
}