我找不到任何解决scheme如何以非交互方式在docker容器中安装mysql-5.6。 我发现下面的命令,但他们需要用户input:
# Update the repo list, execute : wget http://repo.mysql.com/mysql-apt-config_0.2.1-1debian7_all.deb dpkg -i mysql-apt-config_0.2.1-1debian7_all.deb # Install apt-get update apt-get install mysql-server-5.6
有没有更好的非交互式安装解决scheme?
mysql56安装mysql56 ,你应该真的使用以下内容:
MySQL是一个广泛使用的开源关系数据库pipe理系统(RDBMS)。
例:
$ docker run -d mysql:5.6 Unable to find image 'mysql:5.6' locally Trying to pull repository docker.io/library/mysql ... 5.6: Pulling from library/mysql 23286f48d129: Pull complete cbee5247e891: Pull complete ed751d9dbe3b: Pull complete 66a9f45a6f88: Pull complete f50b60617e9c: Pull complete c03269bf1687: Pull complete b14dd0099b51: Pull complete 9acd57cae939: Pull complete 3153a44fc5c3: Pull complete 8b36d77ab230: Pull complete d574478a62d8: Pull complete ac82a224055d: Pull complete e3ce3c9ce67d: Pull complete 57c790472a9d: Pull complete 49772bf40877: Pull complete 73f07a1d187e: Pull complete 3446fa8ab4bb: Pull complete 70c40ffe6275: Pull complete 54672d2ddb6f: Pull complete Digest: sha256:03646869dfecf96f443640f8b9040fbde78a96269aaf47bbfbb505a4c1adcad9 Status: Downloaded newer image for docker.io/mysql:5.6 c6e1f30da1435f2c10e8cd2170d69e67d5cb8e307e1ce52af35506813537971a $
或者 ,您也可以使用Docker Compose 。
我不知道这是否适用于dpkg,因为我很less使用debian,但是Unix通常有一个交互式任务脚本的方法:
shell#] cat > answers.txt << EOF answer1 true yes no answer10 EOF shell#] interactive-command < answers.txt
answers.txt文件中的每一行都回答了交互式设置过程中的一个问题。 你不必像这个例子那样使用HERE文件; VIM,微微,纳米,无论可以创build答案文件。
在Dockerfile中,您可以添加answers.txt文件,然后运行该命令,将答案文件传送给交互式命令的stdin。