2 # -------------------------------------------------------------------------
3 # Copyright (c) 2017 AT&T Intellectual Property
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # -------------------------------------------------------------------------
18 # In this example we are building a docker bridge network(music-net) for all
20 # Then we connect the host bridge network(bridge) to the internal network(music-net)
24 CASS_IMG=nexus3.onap.org:10001/onap/music/cassandra_music:latest
25 TOMCAT_IMG=nexus3.onap.org:10001/library/tomcat:8.0
26 ZK_IMG=nexus3.onap.org:10001/library/zookeeper:3.4
27 MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:latest
29 CASS_USERNAME=cassandra1
30 CASS_PASSWORD=cassandra1
32 if [ "$1" = "start" ]; then
34 # Create Volume for mapping war file and tomcat
35 docker volume create music-vol;
37 # Create a network for all the containers to run in.
38 docker network create music-net;
41 docker run -d --rm --name music-db --network music-net \
42 -p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" \
43 -e CASSUSER=${CASS_USERNAME} \
44 -e CASSPASS=${CASS_PASSWORD} \
48 docker run -d --rm --name music-war \
53 docker run -d --rm --name music-zk --network music-net
54 -p "2181:2181" -p "2888:2888" -p "3888:3888" \
60 # Start Up tomcat - Needs to have properties,logs dir and war file volume mapped.
61 docker run -d --rm --name music-tomcat --network music-net -p "8080:8080" \
62 -v music-vol:/usr/local/tomcat/webapps \
63 -v ${WORK_DIR}/properties:/opt/app/music/etc:ro \
64 -v ${WORK_DIR}/logs:/opt/app/music/logs \
67 # Connect tomcat to host bridge network so that its port can be seen.
68 docker network connect bridge music-tomcat;
73 # Shutdown and clean up.
74 if [ "$1" = "stop" ]; then
75 docker stop music-war;
78 docker stop music-tomcat;
79 docker network rm music-net;
81 docker volume rm music-vol;