-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose-test-code.txt
127 lines (96 loc) · 5.55 KB
/
compose-test-code.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#- /e/lnmp-test/data/sh/mysql57:docker-entrypoint-initdb.d
#docker container rm $(docker container ls -a -q)
#docker container stop $(docker container ps -a -q)
#docker-machine restart
#docker image rm
#通过dockerfile构建镜像
docker build -t 镜像名 上下文路径
docker run -d --rm --name 容器名 镜像
#---------------测试php-fpm------------------
#docker run --name testphp -d -v /e/lnmp-test/data/storage:/data/storage -v /e/lnmp-test/data/app:/var/www/html -v /e/lnmp-test/data/logs:/data/logs -v /e/lnmp-config/php/www.conf:/usr/local/etc/php-fpm.d/www.conf cat2xyj/mini_php
#docker run --name testphp -d --rm -v /e/lnmp-config/php/www.conf:/usr/local/etc/php-fpm.d/ cat2xyj/mini_php
#docker run --name testphp -d --rm -v E:\lnmp-config\php\www.conf:/usr/local/etc/php-fpm.d/www.conf cat2xyj/mini_php
#docker run --name testphp -it --rm cat2xyj/mini_php
#docker run --name testphp -d --rm cat2xyj/mini_php
docker exec -it testphp sh
php-fpm -t 测试php-fpm
php --ini 查看php加载的(php.ini)配置信息
docker run --name testphp -d --rm -p 9000:9000 \
-v /dockershare/lnmp-config/php/www.conf:/usr/local/etc/php-fpm.d/www.conf \
-v /dockershare/lnmp-config/php/php.ini:/usr/local/etc/php/php.ini \
cat2xyj/mini_php
#--------测试mysql5.7的容器构建问题--------
#docker run --name testmysql -d --rm -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
#docker exec -it testmysql sh vim
#docker run --name testmysql -d --rm -e MYSQL_ROOT_PASSWORD=123456 -v /e/lnmp-config/mysql/my.cnf:/etc/mysql/my.cnf mysql:5.7
#docker run --name testmysql -d --rm -e MYSQL_ROOT_PASSWORD=123456 -v /e/lnmp-config/mysql:/etc/mysql mysql:5.7
#docker run --name testmysql -d --rm -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
#docker exec -it testmysql bash
#一下挂载文件 在win7下会 忽略my.cnf配置文件
#解决方法 https://stackoverflow.com/questions/37001272/fixing-world-writable-mysql-error-in-docker
docker run --name testmysql -d --rm -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 \
-v /dockershare/lnmp-config/mysql/my.cnf:/etc/mysql/my.cnf \
mysql:5.7
docker run --name testmysql -d -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 \
-v /dockershare/lnmp-config/mysql/my.cnf:/etc/mysql/conf.d/config-file.cnf \
-v /dockershare/data/storage/mysql57:/var/lib/mysql \
-v /dockershare/data/logs/mysql57:/var/log/mysql \
mysql:5.7 chmod 644 /etc/mysql/conf.d/config-file.cnf && mysql:5.7:/entrypoint.sh mysqld
docker run --name testmysql -d --rm -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 testmysql-image
docker run --name testmysql -d -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 \
-v /storage/mysql57:/var/lib/mysql \
-v /dockershare/data/logs/mysql57:/var/log/mysql \
testmysql-image
docker logs testmysql
docker run --name testmysql -d --rm -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 mysql:5.7
#------------------测试nginx--------------------
#docker run --name testnginx -d --rm -u root -v /e/lnmp-test/data/app:/var/www/html nginx
#docker run --name testnginx -d --rm -u root -v //e/lnmp-test/data/app:/var/www/html nginx
#docker run --name testnginx -d --rm -p 80:80 -v //e/lnmp-test/data/app:/usr/share/nginx/html nginx
#docker run --name testnginx -d --rm -p 80:80 -v /dockershare/temp/nginx/:/etc/nginx/conf.d nginx:1.14.2
#docker run --name testnginx -d --rm -p 80:80 -v /dockershare/lnmp-config/nginx/nginx.conf:/etc/nginx/nginx.conf nginx:1.14.2
#docker exec -it testnginx sh
docker run --name testnginx -d --rm -p 80:80 \
-v /dockershare/data/logs/nginx:/var/log/nginx \
-v /dockershare/lnmp-config/nginx/nginx.conf:/etc/nginx/nginx.conf \
-v /dockershare/lnmp-config/nginx/sites:/etc/nginx/conf.d \
-v /dockershare/app:/data/app \
nginx:1.14.2
#测试php-fpm
docker run --name testphp -d --rm -p 80:80 -v /dockershare/lnmp-config/php/www.conf:/usr/local/etc/php-fpm.d/www.conf -v /dockershare/lnmp-config/php/php.ini:/usr/local/etc/php/php.ini cat2xyj/mini_php
#安装 docke-compose
sudo curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` > /dockershare/soft/docker-compose
#查看容器IP
docker inspect -f "{{.NetworkSettings.Networks.容器网络名称}}"
docker inspect -f "{{.NetworkSettings.Networks.dockershare_lnmp}}" $(docker container ps -a -q)
#------------------测试redis--------------------
docker container stop testredis
docker run --name testredis -d --rm -p 6379:6379 \
-v /dockershare/data/storage/redis:/data/storage/redis \
-v /dockershare/lnmp-config/redis/redis.conf:/usr/local/etc/redis/redis.conf \
redis:5.0.3 \
redis-server /data/config/redis.conf --appendonly no
docker run --name testredis -d --rm -p 6379:6379 \
-v /dockershare/data/logs/redis:/var/log \
-v /dockershare/data/storage/redis:/data/storage/redis \
-v /dockershare/lnmp-config/redis/redis.conf:/usr/local/etc/redis/redis.conf \
redis:5.0.3 \
redis-server /usr/local/etc/redis/redis.conf --appendonly yes
#------------------------elasticsearch测试----------------------
docker run -di --name=test_es -e "ES_JAVA_OPTS=-Xms512m -Xmx512m" -e "discovery.type=single-node" -p 9200:9200 -p 9300:9300 elasticsearch:7.9.0
docker exec -it my-es bash
# 修改了环境变量 立即生效
source /etc/profile
# 进入vbox安装目录 执行对硬盘的扩容
.\VBoxManage.exe modifymedium "D:\VirtualBox VMs\ubuntu\ubuntu-disk001.vdi" --resize 20000
根据uuid扩容
查看硬盘uuid
.\VBoxManage.exe list hdds
根据uuid扩容
.\VBoxManage.exe modifyhd 815d0724-dfae-44c6-8e1b-022d979eb6b5 --resize 20480
https://registry.docker-cn.com
重启docker服务
sudo kill -SIGHUP $(pidof dockerd)
或者 推荐下面这个
systemctl start docker.service
systemctl restart docker.service