docker挂载数据卷emqx.conf导致启动失败

环境

  • EMQX 版本:5.8.0
  • 操作系统版本:macOS 15.0.1

重现此问题的步骤

  1. 创建一个emqx.conf
gateway {
  mqttsn {
    broadcast = true
    enable_qos3 = true
    enable_stats = true
    gateway_id = 1
    idle_timeout = "30s"
    listeners {
      udp {
        default {
          bind = "1884"
          max_conn_rate = 1000
          max_connections = 1024000
        }
      }
    }
    mountpoint = ""
    predefined = []
  }
}
  1. 通过docker-compose.yaml挂载到/opt/emqx/etc/emqx.conf
  emqx:
    image: emqx:5.8.0
    container_name: emqx
    restart: always
    ports:
      - 1883:1883
      - 1884:1884/udp
      - 8083:8083
      - 8084:8084
      - 8883:8883
      - 18083:18083
    environment:
      EMQX_DASHBOARD__DEFAULT_PASSWORD: 123456
    volumes:
      - ./volumes/emqx/log:/opt/emqx/log
      - ./volumes/emqx/data:/opt/emqx/data
      - ./emqx.conf:/opt/emqx/etc/emqx.conf
  1. 通过 docker compose 启动后报错:

预期行为

启动成功并加载配置

实际行为

报错

你好像把 emqx.conf 里必要的内容删掉了。

原来这些内容你不要删:
cat _build/emqx-enterprise/rel/emqx/etc/emqx.conf

node {
  name = "emqx@127.0.0.1"
  cookie = "emqxsecretcookie"
  data_dir = "data"
}

cluster {
  name = emqxcl
  discovery_strategy = manual
}

dashboard {
    listeners {
        http {
            bind = 18083
        }
        https {
            ssl_options {
                certfile = "${EMQX_ETC_DIR}/certs/cert.pem"
                keyfile = "${EMQX_ETC_DIR}/certs/key.pem"
            }
        }
    }
}
1 个赞