docker部署 启动基础模块报错

星辰
星辰 剑圣 2019-09-26 11:57

一、该问题的重现步骤是什么?

1.  cd /usr/local

2.  ./deploy.sh base 启动基础模块失败

二、你期待的结果是什么?实际看到的又是什么?

期望的结果:创建并运行docker成功

实际看到的:创建并运行docker失败


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

产品:BladeX企业版

版本:2.0.7.RELEASE

操作系统:centos7

运行场景:在一台centos7的虚拟机中单机使用docker部署项目。


四、请提供详细的错误堆栈信息,这很重要。

  • 运行时的错误

image.png

  • docker-compose.yml

version: '3'
services:
  mysql:
    container_name: mysql8
    environment:
      MYSQL_ROOT_PASSWORD: "123456"
    image: "mysql/mysql-server:8.0.17"
    restart: always
    ports:
      - "3306:3306"

  nacos:
    image: nacos/nacos-server
    hostname: "nacos-standalone"
    environment:
      - MODE=standalone
      - TZ=Asia/Shanghai
    volumes:
      - /docker/nacos/standalone-logs/:/home/nacos/logs
      - /docker/nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties
    ports:
      - 8848:8848

  sentinel:
    image: bladex/sentinel-dashboard
    hostname: "sentinel"
    environment:
      - TZ=Asia/Shanghai
    ports:
      - 8858:8858
    restart: on-failure

  blade-nginx:
    image: nginx
    hostname: "blade-nginx"
    environment:
      - TZ=Asia/Shanghai
    ports:
    - 88:88
    volumes:
    - /docker/nginx/api/nginx.conf:/etc/nginx/nginx.conf
    privileged: true
    restart: always
    networks:
    - blade_net

  web-nginx:
    image: nginx
    hostname: "web-nginx"
    environment:
      - TZ=Asia/Shanghai
    ports:
      - 8000:8000
    volumes:
      - /docker/nginx/web/html:/usr/share/nginx/html
      - /docker/nginx/web/nginx.conf:/etc/nginx/nginx.conf
    privileged: true
    restart: always
    networks:
      - blade_net

  blade-redis:
    image: redis
    hostname: "blade-redis"
    environment:
      - TZ=Asia/Shanghai
    ports:
    - 3379:6379
    volumes:
    - /docker/redis/data:/data
    command: "redis-server --appendonly yes"
    privileged: true
    restart: always
    networks:
    - blade_net

  blade-admin:
    image: "${REGISTER}/blade/blade-admin:${TAG}"
    environment:
      - TZ=Asia/Shanghai
    ports:
    - 7002:7002
    privileged: true
    restart: always
    networks:
    - blade_net

  blade-gateway:
    image: "${REGISTER}/blade/blade-gateway:${TAG}"
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    restart: always
    networks:
      blade_net:
        ipv4_address: 172.30.0.81

  blade-auth:
    image: "${REGISTER}/blade/blade-auth:${TAG}"
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    restart: always
    networks:
      blade_net:
        ipv4_address: 172.30.0.91

  blade-log:
    image: "${REGISTER}/blade/blade-log:${TAG}"
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    restart: always
    networks:
    - blade_net

  blade-desk:
    image: "${REGISTER}/blade/blade-desk:${TAG}"
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    restart: always
    networks:
    - blade_net

  blade-user:
    image: "${REGISTER}/blade/blade-user:${TAG}"
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    restart: always
    networks:
    - blade_net

  blade-system:
    image: "${REGISTER}/blade/blade-system:${TAG}"
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    restart: always
    networks:
    - blade_net

  blade-flow:
    image: "${REGISTER}/blade/blade-flow:${TAG}"
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    restart: always
    networks:
      - blade_net

  blade-flow-design:
    image: "${REGISTER}/blade/blade-flow-design:${TAG}"
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    restart: always
    ports:
      - 9999:9999
    networks:
      - blade_net

  blade-resource:
    image: "${REGISTER}/blade/blade-resource:${TAG}"
    environment:
      - TZ=Asia/Shanghai
    privileged: true
    restart: always
    networks:
      - blade_net

networks:
  blade_net:
    driver: bridge
    ipam:
      config:
      - subnet: 172.30.0.0/16


  • api/nginx.conf

user  root;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    #include /etc/nginx/conf.d/*.conf;

    upstream gateway {
                 server 172.30.0.81:8088;
             }

    upstream auth {
                 server 172.30.0.91;
             }

    server {
      listen       88;
      server_name  gateway;
      location / {
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_buffering off;
           proxy_pass http://gateway;
      }
    }

    server {
      listen       9000;
      server_name  auth;
      location / {
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_buffering off;
           proxy_pass http://auth;
      }
    }

}
  • web/nginx.conf

user  root;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    #include /etc/nginx/conf.d/*.conf;

    upstream gateway {
                 server 172.30.0.81:8088;
             }


    server {
      listen       8000;
      server_name  web;
      root         /usr/share/nginx/html;

      location / {

      }

      location ^~/api {
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_buffering off;
           rewrite ^/api/(.*)$ /$1 break;
           proxy_pass http://gateway;
      }
    }


}


1条回答
  • 2019-09-27 10:00

    看提示是网络问题,猜测 是端口占用了,可以 netstat 看下端口是否被占用了。

    0 讨论(0)
提交回复