各位大佬 我用dockerfile安装了mysql容器怎么挂载数据文件目录

2022-08-11 教育 101阅读
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"]
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com