I'm trying to build a sql docker container from ubuntu base. I build the image and run it. And am able to confirm that it's running, however it dies right away. How would I keep it alive?
Docker File
FROM ubuntu
RUN apt-get update && \
apt-get install -y mysql-server
COPY run.sh /sbin/run.sh
COPY createDBTable.sql /
RUN chmod 755 /sbin/run.sh
CMD ["./sbin/run.sh"]
run.sh
#!/bin/sh
service mysql start
cat createDBTable.sql | mysql -u root
echo "show databases" | mysql -u root
Output of docker run
* Starting MySQL database server mysqld
...done.
Database
information_schema
<new table>
mysql
performance_schema
sys