各位大佬 我用dockerfile安装了mysql容器怎么挂载数据文件目录_百度...
发布网友
发布时间:2022-04-25 14:43
我来回答
共1个回答
热心网友
时间:2022-04-09 12:11
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"]