2
2
#
3
3
# Command Line Interface to start all services associated with the Getting-Started Tutorial
4
4
#
5
- # For this tutorial the commands are merely a convenience script to run docker-compose
6
- #
5
+ # For this tutorial the commands are merely a convenience script to run ${dockerCmd}#
7
6
8
7
set -e
9
8
10
- if (( $# != 1 )) ; then
11
- echo " Illegal number of parameters"
9
+ dockerCmd=" docker compose"
10
+ if (( $# == 2 )) ; then
11
+ dockerCmd=" docker-compose"
12
+ fi
13
+
14
+ if (( $# < 1 )) ; then echo " Illegal number of parameters"
12
15
echo " usage: services [create|start|stop]"
13
16
exit 1
14
17
fi
@@ -25,7 +28,7 @@ stoppingContainers () {
25
28
echo -e " Force removal of \033[1mmqtt-subscriber\033[0m"
26
29
(docker stop mqtt-subscriber & > /dev/null) || (echo -e " \033[1mmqtt-subscriber\033[0m not running" )
27
30
echo " Stopping running containers"
28
- docker-compose down -v --remove-orphans
31
+ ${dockerCmd} down -v --remove-orphans
29
32
}
30
33
31
34
displayServices () {
@@ -110,7 +113,7 @@ case "${command}" in
110
113
echo -e " - \033[1mTutorial\033[0m acts as a series of dummy IoT Sensors over MQTT"
111
114
echo -e " - \033[1mMosquitto\033[0m acts as an MQTT Message Broker"
112
115
echo " "
113
- docker-compose up -d --remove-orphans
116
+ ${dockerCmd} up -d --remove-orphans
114
117
waitForMongo
115
118
addDatabaseIndex
116
119
waitForOrion
@@ -126,7 +129,7 @@ case "${command}" in
126
129
export $( cat .env | grep " #" -v)
127
130
echo " Pulling Docker images"
128
131
docker pull curlimages/curl
129
- docker-compose pull
132
+ ${dockerCmd} pull
130
133
;;
131
134
* )
132
135
echo " Command not Found."
0 commit comments