您好,登錄后才能下訂單哦!
[root@mytest mariadb10.3]# cat Dockerfile?
FROM centos
MAINTAINER xingzhenxiang 20190610
ADD MariaDB.repo /etc/yum.repos.d/MariaDB.repo
RUN yum install -y MariaDB-server
ENV PASSWD 123456
RUN yum clean all
RUN chmod 777 -R /var/lib/mysql
ADD run.sh /
RUN chmod 755 /run.sh
# Expose ports.??
VOLUME /var/lib/mysql
EXPOSE? 3306
CMD ["/run.sh"]
[root@mytest mariadb10.3]# cat run.sh
#!/bin/bash
cp /usr/share/mysql/mysql.server /etc/init.d/mysql.server
mysql_install_db --user=mysql
#sleep 20
/etc/init.d/mysql.server start
sleep 20
mysql -uroot -e "update mysql.user set host='%',password=password($PASSWD) where host='::1'; flush privileges;"
sleep 20
tail -f? /var/lib/mysql/`hostname`.err
[root@mytest mariadb10.3]# ll
總用量 16
-rw-r--r-- 1 root root 287 6月? 10 14:43 Dockerfile
-rw-r--r-- 1 root root 173 6月? ?6 10:26 MariaDB.repo
-rw-r--r-- 1 root root 316 6月? 10 16:02 run.sh
-rw-r--r-- 1 root root 109 6月? ?6 12:28 run.sh.bak
[root@mytest mariadb10.3]# cat MariaDB.repo?
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64/
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
[root@mytest mariadb10.3]#?
?docker build -t mytest/mariadb10.3 .
? docker run? -d? -p 3306:3306? -v /data/dockertest/mysql:/var/lib/mysql --name mariadb5? mytest/mariadb10.3
?mysql? -h227.0.0.1 -uroot -P3306 -p123456
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。