docker怎么在容器mysql写数据
1个回答
展开全部
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"]
[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"]
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |