-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdcoker-compose.yml.txt
137 lines (95 loc) · 2.53 KB
/
dcoker-compose.yml.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
docker-compose is an add on in the docker engine
docker-compose.yml
version"3"
services:
web:
image: nginx
ports: -80:80
cache:
image: redis
port isn't needed for redis when we're using it for cache purpose
docker-compose config
docker-compose up -d
docker-compose up
docker-compose top cache
docker-compose up --scale cache=2 -d */ we can scale the containers which isn't attached with the ports
docker-compose down */ which will delete the images as well
docker images
docker rmi imageid */image id is there in "docker images"
docker network list
bridge network -- it will autoconnect with all the machines
docker-compose -p dev ps */naming convention it will show in dev_cache
docker-compose.yml
version"3"
services:
web:
image: nginx
container_name: lb
ports:
- "80:80"
cache:
container_name: caching
image: redis
docker-compose -p uat up -d
creating n/w "uat_default" with default driver
docker-compose -p uat ps
out put will be in the name of container name
note: supervisord can be used to run multiple services in a container
dcoker - immutable infrastructure, shouldn't be changed (test, baked & build and it will run)
prod - a service should be running in a container
Volumes:
docker-compose.yml
version"3"
services:
web:
image: nginx
container_name: lb
ports:
- "80:80"
volumes:
-data:/etc/niginx
-webdata:/usr/share/nginx/html
cache:
container_name: caching
image: redis
volumes:
data:
webdata:
dcoker-compose -p uat down
docker volume list
dcoker-compose config
docker compose up -d
docker volume list
docker volume inspect projects_data
cd /var/lib/docker/volumes/projects_data/_data/conf.d
volumes will be crated in the location
/var/lib/docker/volumes/
/var/lib/docker/volumes/projects_data/_data/
index.html */ html changes doesn't need service reload otheriwse we need to do service restart
docker-compose restart
dcoker-compose lb restart --- it's not service name
docker-compose web restart --- web is the service name
build
FROM nginx
RUN echo "Welcome to Doecker" >> /usr/share/nginx/index.html
docker-compose.yml
version"3"
services:
web:
build: . or httpd/. */location of the docker file
container_name: lb
ports:
- "80:80"
volumes:
-data:/etc/niginx
-webdata:/usr/share/nginx/html/index.html
cache:
container_name: caching
image: redis
volumes:
data:
webdata:
docker volume prune */ will delete all the unused volumes
dcoker volume rm */volume name
docker-compose up -d --build
docker images rmi imageid