[Docker] docker install mysql in ubuntu

The summary is based on the following two blogs and their own practice:

https://askubuntu.com/questions/762339/mysql-server-installation-stuck-on-root-password

https://blog.csdn.net/y353027520dx/article/details/77621468 

 

1. Environment

ubuntu16.04
python3.6

 2. Record of my installation steps

FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
LABEL maintainer myname

....

ENV MYSQL_PWD your_passwd
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 update && \
    apt-get -y install MySQL-server-core-5.7 mysql-client-5.7 mysql-server-5.7  --no-install-recommends  && \
    pip --default-time=500 install -i https://pypi.tuna.tsinghua.edu.cn/simple pymysql &&\
    rm -rf /var/lib/apt/lists/*

3. Summary

The more difficult problem for me is that when installing mysql-server directly through apt, after entering the password, there is no response and no longer continues to run. I searched a lot of methods and failed to solve the situation.

1) I have seen mysql docker related, but have not been resolved;

2) Install MySQL-server-core-5.7 mysql-client-5.7 mysql-server-5.7 directly using apt;

3) And modify the - parameter after apt;

4) Enter the "root" password when running through echo;

5) Enter the "root" password manually;

Wait, I haven't solved it, and then I just need to enter the password operation before installation in 2 .

Participation card

1.Mysql-Server installation stuck on root password

2.Linux Ubuntu apt-get install mysql

Guess you like

Origin blog.csdn.net/qq_35975447/article/details/110921506