1. 首先创建一个目录并在目录下创建一个Dockerfile,文件内容如下
[plain] view plain copy print?
FROM centos:centos6
MAINTAINER Fanbin Kong "kongxx@hotmail.com"
RUN yum install -y mysql-server mysql
RUN /etc/init.d/mysqld start &&\
mysql -e "grant all privileges on *.* to 'root'@'%' identified by 'letmein';"&&\
mysql -e "grant all privileges on *.* to 'root'@'localhost' identified by 'letmein';"&&\
mysql -u root -pletmein -e "show databases;"
EXPOSE 3306
CMD ["/usr/bin/mysqld_safe"]