Skip to content

Commit f55e878

Browse files
committed
Add container labels
1 parent ea5636e commit f55e878

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

docker-compose.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
version: "3.5"
1+
version: "3.8"
22
services:
33
designer:
4+
labels:
5+
org.fiware: 'tutorial'
46
image: fogflow/designer:3.2
57
volumes:
68
- ./config.json:/app/config.json
@@ -14,6 +16,8 @@ services:
1416
restart: always
1517

1618
discovery:
19+
labels:
20+
org.fiware: 'tutorial'
1721
image: fogflow/discovery:3.2
1822
volumes:
1923
- ./config.json:/config.json
@@ -24,6 +28,8 @@ services:
2428
restart: always
2529

2630
master:
31+
labels:
32+
org.fiware: 'tutorial'
2733
image: fogflow/master:3.2
2834
volumes:
2935
- ./config.json:/config.json
@@ -39,6 +45,8 @@ services:
3945
restart: always
4046

4147
cloud_broker:
48+
labels:
49+
org.fiware: 'tutorial'
4250
image: fogflow/broker:3.2
4351
volumes:
4452
- ./config.json:/config.json
@@ -50,6 +58,8 @@ services:
5058
restart: always
5159

5260
cloud_worker:
61+
labels:
62+
org.fiware: 'tutorial'
5363
image: fogflow/worker:3.2
5464
volumes:
5565
- /tmp:/tmp
@@ -61,6 +71,8 @@ services:
6171
restart: always
6272

6373
rabbitmq:
74+
labels:
75+
org.fiware: 'tutorial'
6476
image: rabbitmq:3
6577
ports:
6678
- 5672:5672
@@ -69,7 +81,9 @@ services:
6981
- RABBITMQ_DEFAULT_PASS=mypass
7082
restart: always
7183

72-
nginx:
84+
nginx:
85+
labels:
86+
org.fiware: 'tutorial'
7387
image: nginx:latest
7488
volumes:
7589
- ./nginx.conf:/etc/nginx/nginx.conf
@@ -81,7 +95,9 @@ services:
8195
- designer
8296
restart: always
8397

84-
dgraph:
98+
dgraph:
99+
labels:
100+
org.fiware: 'tutorial'
85101
image: dgraph/standalone
86102
volumes:
87103
- ./dgraph:/dgraph

services

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,20 @@ fi
2929

3030

3131
stoppingContainers () {
32-
CONTAINERS=$(docker ps -aq)
32+
CONTAINERS=$(docker ps --filter "label=org.fiware=tutorial" -aq)
3333
if [[ -n $CONTAINERS ]]; then
3434
echo "Stopping containers"
35-
docker rm -f $CONTAINERS
35+
docker rm -f $CONTAINERS || true
3636
fi
3737
VOLUMES=$(docker volume ls -qf dangling=true)
3838
if [[ -n $VOLUMES ]]; then
3939
echo "Removing old volumes"
40-
docker volume rm $VOLUMES
40+
docker volume rm $VOLUMES || true
41+
fi
42+
NETWORKS=$(docker network ls --filter "label=org.fiware=tutorial" -q)
43+
if [[ -n $NETWORKS ]]; then
44+
echo "Removing tutorial networks"
45+
docker network rm $NETWORKS || true
4146
fi
4247
}
4348

0 commit comments

Comments
 (0)