thx / rap2-delos

阿里妈妈前端团队出品的开源接口管理工具RAP第二代
http://rap2.taobao.org
MIT License
7.64k stars 1.35k forks source link

docker第一次运行初始化数据库时错误 #861

Open januwA opened 2 years ago

januwA commented 2 years ago

BUG描述 初始化mysql错误,mysql容器无法运行

复现步骤

$ docker-compose exec delos node scripts/init
Unable to connect to the database: ConnectionError [SequelizeConnectionError]: getaddrinfo EAI_AGAIN mysql
    at /app/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:133:19
    at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:547:31) 
    at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/app/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/app/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/app/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:464:21) {
  parent: Error: getaddrinfo EAI_AGAIN mysql
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:69:26) {
    errno: -3001,
    code: 'EAI_AGAIN',
    syscall: 'getaddrinfo',
    hostname: 'mysql',
    fatal: true
  },
  original: Error: getaddrinfo EAI_AGAIN mysql
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:69:26) {
    errno: -3001,
    code: 'EAI_AGAIN',
    syscall: 'getaddrinfo',
    hostname: 'mysql',
    fatal: true
  }
}
(node:147) UnhandledPromiseRejectionWarning: SequelizeConnectionError: getaddrinfo EAI_AGAIN mysql
    at /app/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:133:19
    at tryCatcher (/app/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/app/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/app/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/app/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/app/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/app/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/app/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/app/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:464:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:147) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on 
unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:147) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

期望结果

实际结果

截图 image

环境

附加信息 rap 2.2.3 版本

> docker --version
Docker version 20.10.11, build dea9396
> docker-compose --version
Docker Compose version v2.2.1
daniel-wuhj commented 2 years ago

https://stackoverflow.com/questions/66831863/mysql-docker-container-keeps-restarting