6

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 ?

3
  • Can you add the contents of your Dockerfile to the question? – belacqua May 27 '16 at 20:54
  • Have you considered using an official image? hub.docker.com/_/mysql – belacqua May 27 '16 at 21:14
  • Indeed I've solved this by using the official image in a seperate container then using docker-compose , but installing mysql into another image like ubuntu or debian never worked to me. – storm May 28 '16 at 8:22
9

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.