Mysql-Server 安装卡在 root 密码上

sto*_*orm 6 mysql docker

我试图安装mysql-server到一个Docker容器中,所以在我添加的 Dockerfile 中apt-get install mysql-server,安装运行直到它要求提供 root 用户的密码,然后就卡在那里,即使我提供空白密码也没有任何反应。

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:
Run Code Online (Sandbox Code Playgroud)

我不知道这是一个错误还是与 docker 有什么关系 以前有人遇到过吗?

Sam*_*son 9

您必须安装 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
Run Code Online (Sandbox Code Playgroud)