docker部署的问题

Blade 未结 1 1815
杨彦彬
杨彦彬 2020-06-10 08:54

192.168.0.10:8848/nacos不能访问

192.168.0.10:88后端api接口

image.png

麻烦问下:nacos的yaml配置文件需要放在哪里;docker ps 查看images已经启动,网页访问不到。谢谢


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

1、我把docker下面的配置文件放到服务器的根目录下并创建docker文件夹。

2、执行deploy.sh文件

docker ps 命令 nacos和其他微服务会自动退出。

image.png

api的nginx配置文件如下

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 192.168.0.10:8888;
             }

    upstream auth {
                 server 192.168.0.10:8100;
             }

    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       9001;
      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;
      }
    }

}

docker-compose.yml文件如下

version: '3'
services:
  nacos:
    image: nacos/nacos-server:1.1.4
    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
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

  sentinel:
    image: bladex/sentinel-dashboard:1.7.1
    hostname: "sentinel"
#    environment:
#      - TZ=Asia/Shanghai
    ports:
      - 8858:8858
    restart: on-failure
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

  seata-server:
    image: seataio/seata-server:1.1.0
    hostname: "seata-server"
    ports:
      - 8091:8091
#    environment:
#      - TZ=Asia/Shanghai
#      - SEATA_PORT=8091
#      - STORE_MODE=file
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

  blade-nginx:
    image: nginx:stable-alpine-perl
    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:stable-alpine-perl
    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:5.0.8-alpine
    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-turbine:
    image: "${REGISTER}/blade/blade-turbine:${TAG}"
#    environment:
#      - TZ=Asia/Shanghai
    ports:
      - 7003:7003
    privileged: true
    restart: always
#    networks:
#      - blade_net

  blade-zipkin:
    image: "${REGISTER}/blade/blade-zipkin:${TAG}"
#    environment:
#      - TZ=Asia/Shanghai
    ports:
      - 9411:9411
    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: 192.168.0.10

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

  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

  blade-client:
    image: "${REGISTER}/blade/blade-client:${TAG}"
    ports:
      - 8130:8130
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

  blade-course:
    image: "${REGISTER}/blade/blade-course:${TAG}"
    ports:
      - 8128:8128
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

  blade-display:
    image: "${REGISTER}/blade/blade-display:${TAG}"
    ports:
      - 8129:8129
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

  blade-market:
    image: "${REGISTER}/blade/blade-market:${TAG}"
    ports:
      - 8132:8132
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

  blade-order:
    image: "${REGISTER}/blade/blade-order:${TAG}"
    ports:
      - 8140:8140
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

  blade-school:
    image: "${REGISTER}/blade/blade-school:${TAG}"
    ports:
      - 8126:8126
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

  blade-setting:
    image: "${REGISTER}/blade/blade-setting:${TAG}"
    ports:
      - 8133:8133
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

  blade-wechat:
    image: "${REGISTER}/blade/blade-wechat:${TAG}"
    ports:
      - 8222:8222
#    networks:
#      blade_net:
#        ipv4_address: 192.168.0.10

#networks:
#  blade_net:
#    driver: bridge
#    ipam:
#      config:
#      - subnet: 192.168.0.10

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

运行正常;地址无法访问

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

Bladex 2.5.0 win10

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


五、若有更多详细信息,请在下面提供。

1条回答
  •  smallchill
    smallchill (楼主)
    2020-06-11 14:49

    服务器内存有多少? 如果服务自动退出的话有两种可能:
     1. nacos配置不对,访问出错导致关闭

     2. 内存不够,服务启动报oom导致关闭

    这个问题你需要docker logs -f {容器id},看一下具体打印的日志是什么,才能往下一步走。

    另外文档这块应该已经描述的很清楚了呀

    image.png

    0 讨论(0)
提交回复