dockerfile-mariadb

1:dockerfile

  FROM centos:7
  MAINTAINER WANG
  RUN yum install -y mariadb-server net-tools expect
  ADD start.sh /opt/
  RUN chmod +x /opt/start.sh
  RUN /opt/start.sh
  ENV LC_ALL en_US.UTF-8
  EXPOSE 3306
  CMD ["mysqld_safe"]

2:start.sh

  #!/bin/bash
  mysql_install_db --user=mysql
  (mysqld_safe &) | grep a
  sleep 3s
  ps -A
  netstat -ntpl
  sleep 3s
  mysqladmin -u root password '123456'
  sleep 3s
  mysql -uroot -p123456 -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456'" 
  sleep 3s

3:测试结果

posted @ 2020-10-24 15:53  BlueSky-  阅读(613)  评论(0)    收藏  举报