【发布时间】:2016-01-29 14:03:24
【问题描述】:
我在 Dockerfile 中工作,但我需要运行一个“安全”的 MariaDB 服务器脚本,它是交互式的,我不知道如何处理。
基本上这是我在测试环境中在脚本上遵循的流程,与我想在 Dockerfile 中实现的流程相同,无需用户交互,只需按照您在下面的流程中看到的回答即可:
# /usr/bin/mysql_secure_installation
Enter current password for root (enter for none): [ENTER] // because there is no password
OK, successfully used password, moving on...
Set root password? [Y/n] n
... skipping.
Remove anonymous users? [Y/n] Y
... Success!
Disallow root login remotely? [Y/n] n
... skipping.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
所以我需要编写一个 bash 脚本或其他可以自动处理此问题但不知道的东西,您将如何处理?
【问题讨论】: