我正在使用docker image(deitch / mysql-backup)设置mysql数据库还原。
我创建了一个docker-compose文件,其中使用docker image deitch / mysql-backup实现了用于mysql数据库还原的服务。
restore:
image: databack/mysql-backup
volumes:
- ./dbRestore/Dump20190824.sql.tar.gz:/dbr/Dump20190824.sql.tar.gz
environment:
- DB_RESTORE_TARGET=/dbr/Dump20190824.sql.tar.gz
- DB_USER=root
- DB_PASS=root
- DB_PORT=3306
- DB_DUMP_DEBUG=true
- DB_SERVER=mysql
depends_on:
- mysql
当我运行docker-compose时,出现此错误-
restore_1 | ERROR 1046 (3D000) at line 22: No database selected
答案 0 :(得分:0)
我想出了一个满足我要求的docker-compose服务配置。
backup:
image: databack/mysql-backup
restart: always
user: "0"
volumes:
- ./dbBackup:/dbb
environment:
- DB_DUMP_TARGET=/dbb
- DB_USER=root
- DB_PASS=root
- DB_PORT=3306
- DB_NAMES=karakira
- DB_DUMP_FREQ=720
- DB_DUMP_BEGIN=+90
- DB_SERVER=mysql
depends_on:
- django