Open hitto2008 opened 3 years ago
同碰到了该问题,发现 compose 中的 mysql 并没有成功启动,根据提示 删掉这一行, MYSQL_USER: "root" 。 重新执行 docker-compose down docker-compose up -d 再次检查 是否四个 comtatiner 都正常启动, 接着执行 mysql 脚本即可。
初始化遇到同样的问题,初始化 redis
报错,没有修改过 docker-compose.yml
文件
@TinsFox @ilovetM @hitto2008
在 docker-compose.yml
文件 声明一下container_name。
redis:
image: redis:4
container_name: redis
mysql:
image: mysql:5.7
container_name: mysql
同样的问题:
root@iZj6c7ekw9ph5j1ckkz2z9Z:/rap# docker-compose down
Stopping rap_delos_1 ... done
Stopping rap_dolores_1 ... done
Stopping rap_redis_1 ... done
Removing rap_delos_1 ... done
Removing rap_mysql_1 ... done
Removing rap_dolores_1 ... done
Removing rap_redis_1 ... done
Removing network rap_default
root@iZj6c7ekw9ph5j1ckkz2z9Z:/rap# docker-compose up -d
Creating network "rap_default" with the default driver
Creating rap_dolores_1 ...
Creating rap_mysql_1 ...
Creating rap_redis_1 ...
Creating rap_dolores_1
Creating rap_mysql_1
Creating rap_redis_1 ... done
Creating rap_delos_1 ...
Creating rap_delos_1 ... done
root@iZj6c7ekw9ph5j1ckkz2z9Z:/rap# 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:25) 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:25) 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:25) [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.
docker-compose.yml 只改了前端端口号
应该是你的系统里面本身就跑了mysql服务,和docker部署的配置有冲突,不能连接到mysql @hitto2008
同碰到了该问题,发现 compose 中的 mysql 并没有成功启动,根据提示 删掉这一行, MYSQL_USER: "root" 。 重新执行 docker-compose down docker-compose up -d 再次检查 是否四个 comtatiner 都正常启动, 接着执行 mysql 脚本即可。
谢了,这个对我有效。
BUG描述 首次运行 docker-compose exec delos node scripts/init 报错。 Unable to connect to the database: HostNotFoundError [SequelizeHostNotFoundError]: getaddrinfo ENOTFOUND mysql at /app/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:127:19
复现步骤 1、docker方式安装,使用源代码中的docker-compose.yml,不修改任何信息。 2、运行 docker-compose up -d ,镜像正常下拉并成功,无任务异常。 3、按照文档步骤,首次启动后需要执行 docker-compose exec delos node scripts/init ,报错。异常信息见截图。
环境 centos7 + docker 20.10.6 + docker-compose 1.28.2
附加信息 换了几台服务器都是同样的错误,找不到原因,请各位大佬指点。