-
Notifications
You must be signed in to change notification settings - Fork 1
/
Docker_Run.txt
95 lines (35 loc) · 3.34 KB
/
Docker_Run.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
一、docker run 命令中
示例目录为:E:/conf/docker/
二、 txt文件(编辑->替换) "E:/conf/docker/" ==> "{$path}/docker/"
三、操作示例:
Windowns: "E:/conf/docker/" ==> "D:/conf/docker/"
Linux: "E:/conf/docker/" ==> "/data/conf/docker/"
四、批量替换后,直接复制 docker命令,执行。
========================
命令列表
========================
--- 新建网络
如果有固定ip,我们不需要再使用link容器,这样会方便很多,我们这里以10.10.10.0段的网络举例子;
docker network create --subnet=10.10.10.0/16 --gateway=10.10.10.1 ado
--- Nginx
docker run -d --name dc_nginx --net ado --ip 10.10.10.11 -p 80:80 -p 81:81 -p 443:443 -v E:/conf/docker/wwwroot/:/data/wwwroot/ -v E:/conf/docker/logs/nginx/:/var/log/nginx/ -v E:/conf/docker/conf/nginx/certs/:/etc/nginx/certs/ -v E:/conf/docker/conf/nginx/conf.d/:/etc/nginx/conf.d/ -v E:/conf/docker/conf/nginx/nginx.conf:/etc/nginx/nginx.conf -v E:/conf/docker/conf/nginx/my_params:/etc/nginx/my_params nginx
--- php
docker run -d --name dc_php56 --net ado --ip 10.10.10.22 -p 9056:9000 -v E:/conf/docker/wwwroot:/data/wwwroot -v E:/conf/docker/logs/php56/:/var/log/php-fpm/ -v E:/conf/docker/conf/php56/php.ini:/usr/local/etc/php/php.ini -v E:/conf/docker/conf/php56/php-fpm.conf:/usr/local/etc/php-fpm.conf php:5.6-fpm
docker run -d --name dc_php72 --net ado --ip 10.10.10.21 -p 9000:9000 -p 8072:8080 -v E:/conf/docker/wwwroot/:/data/wwwroot/ -v E:/conf/docker/logs/php72/:/var/log/php-fpm/ -v E:/conf/docker/conf/php72/php.ini:/usr/local/etc/php/php.ini -v E:/conf/docker/conf/php72/php-fpm.conf:/usr/local/etc/php-fpm.conf php:7.2.0-fpm
--- mysql
docker run -d --name dc_mysql3307 --net ado --ip 10.10.10.31 -p 3307:3306 -e MYSQL_ROOT_PASSWORD=123456 -v E:/conf/docker/data/mysql/:/var/lib/mysql/ -v E:/conf/docker/logs/mysql/:/var/log/mysql/ -v E:/conf/docker/conf/mysql/conf.d/:/etc/mysql/conf.d/ -v E:/conf/docker/conf/mysql/my.cnf:/etc/mysql/my.cnf mysql:5.6
让其它容器可以连接
docker exec -it mysql bash
mysql -uroot -p123456;
grant all privileges on *.* to admin@'10.10.%' identified by 'adminadmin' with grant option;
flush privileges;
--- redis
docker run -d --name dc_redis --net ado --ip 10.10.10.41 -p 6379:6379 -v E:/conf/docker/data/redis/:/usr/local/redis/data/ -v E:/conf/docker/logs/redis/:/usr/local/redis/logs/ -v E:/conf/docker/conf/redis/redis.conf:/usr/local/redis/redis.conf redis redis-server /usr/local/redis/redis.conf
--- elasticsearch
docker run -d --name dc_es --net ado --ip 10.10.10.61 -p 9200:9200 -p 9300:9300 -v E:/conf/docker/conf/es/elasticsearch_1.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v E:/conf/docker/logs/es/:/usr/share/elasticsearch/logs/ elasticsearch:6.4.0
docker run -d --name dc_es2 --net ado --ip 10.10.10.62 -v E:/conf/docker/logs/es2/:/usr/share/elasticsearch/logs/ -v E:/conf/docker/conf/es/elasticsearch_2.yml:/usr/share/elasticsearch/config/elasticsearch.yml elasticsearch:6.4.0
docker run -d --name dc_es3 --net ado --ip 10.10.10.63 -v E:/conf/docker/logs/es3/:/usr/share/elasticsearch/logs/ -v E:/conf/docker/conf/es/elasticsearch_3.yml:/usr/share/elasticsearch/config/elasticsearch.yml elasticsearch:6.4.0
--- 启动/停止/重启
docker start dc_nginx dc_php56 dc_mysql3307 dc_redis dc_es dc_es2 dc_es3
docker stop dc_nginx dc_php56 dc_mysql3307 dc_redis dc_es dc_es2 dc_es3
docker restart dc_nginx dc_php56 dc_mysql3307 dc_redis dc_es dc_es2 dc_es3