Skip to content

Commit d410821

Browse files
committed
Add container labels
1 parent 44a75e0 commit d410821

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

docker-compose.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
#
1717
# see: https://github.com/FIWARE/helm-charts/
1818
#
19-
version: "3.5"
19+
version: "3.8"
2020
services:
2121
# Orion is the context broker
2222
orion:
23+
labels:
24+
org.fiware: 'tutorial'
2325
image: fiware/orion:${ORION_VERSION}
2426
hostname: orion
2527
container_name: fiware-orion
@@ -57,6 +59,7 @@ services:
5759
- IOTA_NORTH_PORT=${IOTA_NORTH_PORT}
5860
- IOTA_REGISTRY_TYPE=mongodb #Whether to hold IoT device info in memory or in a database
5961
- IOTA_LOG_LEVEL=DEBUG # The log level of the IoT Agent
62+
- IOTA_DEFAULT_EXPRESSION_LANGUAGE=jexl
6063
- IOTA_TIMESTAMP=true # Supply timestamp information with each measurement
6164
- IOTA_CB_NGSI_VERSION=v2 # use NGSIv2 when sending updates for active attributes
6265
- IOTA_AUTOCAST=true # Ensure Ultralight number values are read as numbers not strings
@@ -72,6 +75,8 @@ services:
7275

7376
# Tutorial acts as a series of dummy IoT Sensors over HTTP
7477
tutorial:
78+
labels:
79+
org.fiware: 'tutorial'
7580
image: fiware/tutorials.context-provider
7681
hostname: iot-sensors
7782
container_name: fiware-tutorial
@@ -107,6 +112,8 @@ services:
107112

108113
# Database
109114
mongo-db:
115+
labels:
116+
org.fiware: 'tutorial'
110117
image: mongo:${MONGO_DB_VERSION}
111118
hostname: mongo-db
112119
container_name: db-mongo
@@ -126,6 +133,8 @@ services:
126133

127134
networks:
128135
default:
136+
labels:
137+
org.fiware: 'tutorial'
129138
ipam:
130139
config:
131140
- subnet: 172.18.1.0/24

services

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,20 @@ loadData () {
3636
}
3737

3838
stoppingContainers () {
39-
CONTAINERS=$(docker ps -aq)
39+
CONTAINERS=$(docker ps --filter "label=org.fiware=tutorial" -aq)
4040
if [[ -n $CONTAINERS ]]; then
4141
echo "Stopping containers"
42-
docker rm -f $CONTAINERS
42+
docker rm -f $CONTAINERS || true
4343
fi
4444
VOLUMES=$(docker volume ls -qf dangling=true)
4545
if [[ -n $VOLUMES ]]; then
4646
echo "Removing old volumes"
47-
docker volume rm $VOLUMES
47+
docker volume rm $VOLUMES || true
48+
fi
49+
NETWORKS=$(docker network ls --filter "label=org.fiware=tutorial" -q)
50+
if [[ -n $NETWORKS ]]; then
51+
echo "Removing tutorial networks"
52+
docker network rm $NETWORKS || true
4853
fi
4954
}
5055

0 commit comments

Comments
 (0)