cat Dockerfile
FROM 192.168.200.12:5000/centos-7 MAINTAINER firepunch RUN rm -fv /etc/yum.repos.d/* ADD local.repo /etc/yum.repos.d/ # 红色语句的文件来自上图的配置 RUN yum install -y mariadb-server RUN mysql_install_db --user=mysql ENV LC_ALL en_US.UTF-8 ENV MYSQL_USER xiandian ENV MYSQL_PASS xiandian ADD build_table.sh /root/build_table.sh RUN chmod +x /root/build_table.sh RUN /root/build_table.sh ADD run.sh /root/run.sh RUN chmod u+x /root/run.sh EXPOSE 3306 CMD mysqld_safe
docker build -t 192.168.200.12:5000/taicai/centos-mariadb:v1.0 .
docker run -dit -P 192.168.200.12:5000/taicai/centos-mysql:v1.0
bash-4.2# mysql -uroot Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 5.5.44-MariaDB MariaDB Server Copyright ? 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement. MariaDB [(none)]> select * from chinaskills.company; ±---------±------+ | name | years | ±---------±------+ | xiandian | 2014 | | xiandian | 2015 | ±---------±------+ 2 rows in set (0.00 sec)
最终效果
参考
本地文件:pass练习题.docx dockerfile安装yum_docker离线安装及本地yum配置 局域网搭建hadoop平台——基于基础镜像通过Dockerfile创建Hadoop镜像
|