• 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

    ENV DEBIAN_FRONTEND  #设置静默安装,即非交互

    RUN apt-get update && apt-get install debconf-utils -y
    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

    或者

    ENV DEBIAN_FRONTEND noninteractive
    RUN apt-get update &&
    apt-get -yq install mysql-server-5.6 pwgen &&
    rm -rf /var/lib/apt/lists/*

  • 相关阅读:
    验证或是提示字段请求值
    正则表达式模式
    Linux下squid代理缓存服务环境部署
    memcached缓存知识简单梳理
    MySQL 读写分离方案-Amoeba环境部署记录
    linux系统终端命令提示符设置(PS1)记录
    Gitlab快速部署及日常维护(社区版RPM包方式安装)
    Linux下检测IP地址冲突及解决方法
    Linux如何挂载Windows下的共享文件
    定时备份Windows文件到Linux服务器上(Rsync)
  • 原文地址:https://www.cnblogs.com/yjt1993/p/9922475.html
Copyright © 2020-2023  润新知