docker 静默安装mysql

Posted 北漂-boy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker 静默安装mysql相关的知识,希望对你有一定的参考价值。

debconf-set-selections命令

1.功能作用

在debconf database中插入默认值

2.位置

/usr/bin/debconf-set-selections

3.格式用法

debconf-set-selections [-vcu] [file]

4.主要参数

 

5.应用实例

1、命令行输入设置参数
sudo debconf-set-selections <<< ‘mysql-server-5.5 mysql-server/root_password password your_password‘
sudo debconf-set-selections <<< ‘mysql-server-5.5 mysql-server/root_password_again password your_password‘
sudo apt-get -y install mysql-server

2、先输入文件,再一次性添入设置参数
echo "mysql-server-5.5 mysql-server/root_password password $MYSQL_ROOT_PASS" > /tmp/mysql.preseed
echo "mysql-server-5.5 mysql-server/root_password_again password $MYSQL_ROOT_PASS" >> /tmp/mysql.preseed
cat /tmp/mysql.preseed | sudo debconf-set-selections
rm /tmp/mysql.preseed
sudo apt-get install -y mysql-server

3、使用echo方式输入设置参数
echo ‘mysql-server-5.5 mysql-server/root_password password your_password‘ | sudo debconf-set-selections
echo ‘mysql-server-5.5 mysql-server/root_password_again password your_password‘ | sudo debconf-set-selections
sudo apt-get install -y mysql-server

4、直接从文件中读取设置参数
sudo debconf-set-selections mysql-passwd
sudo apt-get install -y mysql-server

5.docker 中静默安装mysql

RUN apt-get update
RUN echo "mysql-server mysql-server/root_password password root" | debconf-set-selections
RUN echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections
RUN apt-get install -y mysql-server




















以上是关于docker 静默安装mysql的主要内容,如果未能解决你的问题,请参考以下文章

Android静默安装和静默卸载代码

CentOS X64上64位Oracle 11gR2 静默安装

为啥 Docker 容器在启动时会被静默删除

使用 Chef 静默安装特定应用程序版本

android怎么实现apk的静默安装

如何app自动升级 静默安装 android