基于commit命令方式创建
docker的安装
[root@test01 ~]# yum install docker [root@test01 ~]# systemctl enable docker [root@test01 ~]# systemctl start docker
下载本地镜像
[root@test01 ~]# docker pull centos:7.4.1708 [root@test01 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/centos 7.4.1708 3afd47092a0e 3 months ago 196.6 MB
创建交互型容器
[root@test01 ~]# docker run -it --name="mysql_server" centos /bin/bash
安装mariadb服务
[root@e8126d0481d2 /]# yum -y install mariadb-server net-tools
初始化mariadb
[root@e8126d0481d2 /]# mysql_install_db --user=mysql