Skip to content

Commit

Permalink
Add container labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Jan 28, 2022
1 parent 9eca195 commit 53c84e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 7 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
#
# see: https://github.com/FIWARE/helm-charts/
#
version: "3.5"
version: "3.8"
services:
# Orion is the context broker
orion:
labels:
org.fiware: 'tutorial'
image: fiware/orion:${ORION_VERSION}
hostname: orion
container_name: fiware-orion
Expand All @@ -36,6 +38,8 @@ services:

# Databases
mongo-db:
labels:
org.fiware: 'tutorial'
image: mongo:${MONGO_DB_VERSION}
hostname: mongo-db
container_name: db-mongo
Expand All @@ -56,6 +60,8 @@ services:

networks:
default:
labels:
org.fiware: 'tutorial'
ipam:
config:
- subnet: 172.18.1.0/24
Expand Down
11 changes: 8 additions & 3 deletions services
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,20 @@ displayServices () {
}

stoppingContainers () {
CONTAINERS=$(docker ps -aq)
CONTAINERS=$(docker ps --filter "label=org.fiware=tutorial" -aq)
if [[ -n $CONTAINERS ]]; then
echo "Stopping containers"
docker rm -f $CONTAINERS
docker rm -f $CONTAINERS || true
fi
VOLUMES=$(docker volume ls -qf dangling=true)
if [[ -n $VOLUMES ]]; then
echo "Removing old volumes"
docker volume rm $VOLUMES
docker volume rm $VOLUMES || true
fi
NETWORKS=$(docker network ls --filter "label=org.fiware=tutorial" -q)
if [[ -n $NETWORKS ]]; then
echo "Removing tutorial networks"
docker network rm $NETWORKS || true
fi
}

Expand Down

0 comments on commit 53c84e8

Please sign in to comment.