-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] docker v3.1.8 failed to initialize database #1091
Comments
init databasedocker run --rm -it -p8000:8000 -e SECRET_KEY=$SECRET_KEY -e MYSQL_USER=$MYSQL_USER -e MYSQL_ADDR=$MYSQL_ADDR -e MYSQL_PASSWORD=$MYSQL_PASSWORD -e MYSQL_DB=$Yearning_DB -e Y_LANG=zh_CN yeelabs/yearning "/opt/Yearning install" You must initialize your database in the startup containerdocker run -d -it -p8000:8000 -e SECRET_KEY=$SECRET_KEY -e MYSQL_USER=$MYSQL_USER -e MYSQL_ADDR=$MYSQL_ADDR -e MYSQL_PASSWORD=$MYSQL_PASSWORD -e MYSQL_DB=$Yearning_DB -e Y_LANG=zh_CN yeelabs/yearning |
首先,我这个不是初始安装,而是由3.1.7升级到3.1.8的。之前3.1.7版本Yearning已经运行很长时间。数据库已经有大量数据。 |
First of all, this is not an initial installation, but an upgrade from 3.1.7 to 3.1.8. The previous 3.1.7 version of Yearning has been running for a long time. The database already has a lot of data. |
当你使用环境变量后 程序是不会去读取 conf.toml 里面的配置的 只会从环境变量中获取 |
When you use environment variables, the program will not read the configuration in conf.toml, but will only obtain it from the environment variables. |
遇到同样的问题:
结果一看环境变量: # echo $MYSQL_ADDR
= Dockerfile 默认就设置了 MYSQL_ADDR 等环境变量吧: # docker run -it --rm --name=test docker.io/yeelabs/yearning:v3.1.8 bash
0fc36c208799:/opt# env
CHARSET=UTF-8
HOSTNAME=0fc36c208799
MYSQL_DB==
PWD=/opt
Y_LANG== zh-CN
MYSQL_PASSWORD== <------
MYSQL_USER== <------
HOME=/root
LANG=C.UTF-8
SECRET_KEY== dbcjqheupqjsuwsm
TERM=xterm
SHLVL=1
MYSQL_ADDR== <------
LC_COLLATE=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env 会导致
手动操作可以跑通: # unset MYSQL_ADDR MYSQL_DB MYSQL_USER
# ./Yearning --verbose=4 install -c config.toml
# ./Yearning --verbose=4 run -c config.toml |
我提交了 PR 申请 #1113 ,修正了 Dockerfile 上面的一些错误,更新了文档中部分描述内容。 |
I submitted PR request #1113, fixed some errors in the Dockerfile, and updated some descriptions in the documentation. |
Describe the question
docker 从 3.1.7 版本 升级 3.1.8 版本,报错无法连接mysql。一样的docker-compose和 conf.toml配置,回滚到3.1.7后正常运行。
To Reproduce
2024/09/06 16:31:29 Yearning-go/src/model/db.go:66
yearning | [error] failed to initialize database, got error dial tcp: lookup = : no such host
yearning | [Error] 2024-09-06 16:31:29 (Yearning-go/src/model/db.go:72) MySQL connection failed! Please check the configuration information
Expected behavior
跟3.1.7一样正常运行
Screenshots
Deployment
Docker
Env (please complete the following information):
The text was updated successfully, but these errors were encountered: