I trying to install mysql-server into a Docker container so in my Dockerfile I've added apt-get install mysql-server , install runs until it demand to provide the root user's password and then just stuck there and nothing happens even when I provide a blank password.
Configuring mysql-server-5.5
While not mandatory, it is highly recommended that you set a password for the
MySQL administrative "root" user.
If this field is left blank, the password will not be changed.
New password for the MySQL "root" user:I don't know if it's a bug or if it have anything to do with docker Anyone encountered this before ?
31 Answer
You have to set the password before installing MySQL:
# MySQL
ENV MYSQL_PWD Pwd123
RUN echo "mysql-server mysql-server/root_password password $MYSQL_PWD" | debconf-set-selections
RUN echo "mysql-server mysql-server/root_password_again password $MYSQL_PWD" | debconf-set-selections
RUN apt-get -y install mysql-server 0