Dockerfile:
FROM aarongo/centos-ssh-supervisor
MAINTAINER aaron "aaron.docker@gmail.com"
RUN yum install -y mysql-server mysql
RUN /etc/init.d/mysqld start &&\
mysql -e "grant all privileges on *.* to 'user'@'%' identified by 'password';"&&\
mysql -e "grant all privileges on *.* to 'user'@'localhost' identified by 'password';"&&\
mysql -u user -ppassword -e "show databases;"
COPY supervisord.conf /etc/supervisord.conf
VOLUME ["/mysqldata"]
EXPOSE 22 3306
CMD ["/usr/bin/supervisord"]
#VOLUME 选项是将本地的目录挂在到容器中 此处要注意:当你运行-v <hostdir>:<Containerdir> 时要确保目录内容相同否则会出现数据丢失
如果运行成功:
2014-11-26 03:55:27,487 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 stsecs)
2014-11-26 03:55:27,487 INFO success: mysqld entered RUNNING state, process has stayed up for > than 1artsecs)