码迷,mamicode.com
首页 > 数据库 > 详细

docker 静默安装mysql

时间:2018-11-07 15:32:05      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:row   root   静默安装   默认值   selection   文件   conf   作用   int   

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

标签:row   root   静默安装   默认值   selection   文件   conf   作用   int   

原文地址:https://www.cnblogs.com/yjt1993/p/9922475.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!