When Dockerfile build install mysql, after the root password is popped up, there is no response?

  docker, question

When Dockerfile build executes the command apt-get install mysql-server, it pops up and enters the root password, then enters the secret and returns to the car. No response! What’s going on here?


FROM ubuntu:latest
 RUN apt-get -qq update
 RUN apt-get install -qqy nginx mysql-server php-mcrypt

Mysql cannot be installed directly like this.

Reference should be made to the followingMysql Official MirrorThe practice of:

ENV MYSQL_VERSION 8.0.0-dmr-1debian8
 RUN echo "deb  http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list
 # the "/var/lib/  mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database   already "configured" (ie, stuff in /var/lib/mysql/mysql)
 # also, we set debconf keys to make APT a little quieter
 RUN { \
 echo mysql-community-server mysql-community-server/data-dir select '';  \
 echo mysql-community-server mysql-community-server/root-pass password '';  \
 echo mysql-community-server mysql-community-server/re-root-pass password '';  \
 echo mysql-community-server mysql-community-server/remove-test-db select false;  \
 } | debconf-set-selections \
 && apt-get update && apt-get install -y mysql-server="${MYSQL_VERSION}"