FROM centos:centos6 MAINTAINER David "xx@xx.com" RUN yum install -y mysql-server mysql RUN /etc/init.d/mysqld start RUN mysql -e "grant all privileges on *.* to 'root'@'%' identified by '1234';" RUN mysql -e "grant all privileges on *.* to 'root'@'localhost' identified by '1234';" EXPOSE 3306 CMD ["/usr/bin/mysqld"]
FROM centos:centos6 MAINTAINER David "xx@xx.com" RUN yum install -y mysql
David@MacBook-Pro-3 ~$ docker build -t hzc/mysql_server /path/mysql_server/Dockerfile David@MacBook-Pro-3 ~$ docker build -t hzc/mysql_client /path/mysql_client/Dockerfile
David@MacBook-Pro-3 ~$ docker image|grep hzc hzc/mysql_client latest 62cfe52e02bf 2 days ago 289 MB hzc/mysql_server latest 83c64aba0805 2 days ago 377.9 MB
David@MacBook-Pro-3 ~$ docker run -d -P --name=mysql_server hzc/mysql_server David@MacBook-Pro-3 ~$ b5e097fe510d8f258dd82c48a2f6aa4c279e227c4472e42d3e9956ac419ae73c
David@MacBook-Pro-3 ~$ docker run --name=mysql_client1 --link=mysql_server:db -i -t hzc/mysql_client mysql -h db -uroot -p1234 Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 1 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql>
David@MacBook-Pro-3 ~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 213285ec2663 hzc/mysql_client "mysql -h db -uroot -" 2 minutes ago Up 2 minutes mysql_client1 b5e097fe510d hzc/mysql_server "/usr/bin/mysqld_safe" 4 minutes ago Up 4 minutes 0.0.0.0:32768->3306/tcp mysql_server
David@MacBook-Pro-3 ~$ docker exec -it 213285ec2663 bash [root@213285ec2663 /]# env HOSTNAME=213285ec2663 DB_NAME=/mysql_client1/db TERM=xterm DB_PORT=tcp://172.17.0.2:3306 DB_PORT_3306_TCP_PORT=3306 .... DB_PORT_3306_TCP_PROTO=tcp PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD=/ DB_PORT_3306_TCP_ADDR=172.17.0.2 SHLVL=1 HOME=/root DB_PORT_3306_TCP=tcp://172.17.0.2:3306 no_proxy=*.local, 169.254/16 DB_ENV_no_proxy=*.local, 169.254/16 LESSOPEN=||/usr/bin/lesspipe.sh %s G_BROKEN_FILENAMES=1 _=/usr/bin/env
[root@213285ec2663 /]# cat /etc/hosts 127.0.0.1 localhost .... 172.17.0.2 db b5e097fe510d mysql_server 172.17.0.3 213285ec2663
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有