Problem in connecting with mysql in docker

Hi, I’m new to docker I’m trying to build a docker container with mysql and I’ve to dump one sql backup named sqlbkup.sql also, but I’m getting some error with mysql. My Docker file is

FROM ubuntu:14.04

Set the working directory to /app


Copy the current directory contents into the container at /app

ADD . /app

Install any needed packages specified in requirements.txt

RUN apt-get update --assume-yes
RUN apt-get install python-pip build-essential python-dev libmysqlclient-dev --assume-yes
RUN apt-get install libxml2-dev libxslt1-dev --assume-yes
RUN apt-get install python-lxml --assume-yes
RUN echo mysql-server mysql-server/root_password password $MYSQLTMPROOT | debconf-set-selections;
echo mysql-server mysql-server/root_password_again password $MYSQLTMPROOT | debconf-set-selections;
apt-get install -y mysql-server mysql-client libmysqlclient-dev
RUN apt-get install python-mysqldb --assume-yes
RUN pip install -r requirements.txt

Create Database

RUN mkdir /usr/sql
RUN chmod 644 /usr/sql

ADD ["./sqlbkup.sql", “/usr/sql/sqlbkup.sql”]

RUN /etc/init.d/mysql start &&
mysql -u root -p${MYSQLTMPROOT} -e “CREATE DATABASE chom” &&
mysql -u root -p${MYSQLTMPROOT} -D chom < /usr/sql/sqlbkup.sql &&
rm -rd /usr/sql

Make port 80 available to the world outside this container


Define environment variable


Run when the container launches

CMD [“python”, “”]

I’m getting error as

Step 15/18 : RUN /etc/init.d/mysql start && mysql -u root -p${MYSQLTMPROOT} -e “CREATE DATABASE chom” && mysql -u root -p${MYSQLTMPROOT} -D chom < /usr/sql/sqlbkup.sql && rm -rd /usr/sql
—> Running in ff5c3d90c244

  • Starting MySQL database server mysqld
  • Checking for tables which need an upgrade, are corrupt or were
    not closed cleanly.
    —> 5457175968f0

kindly help me to recover from this problem. Thank you