Skip to content

Commit d331f33

Browse files
author
Kristian Ringer
committed
Get container ids from directory the control script is located in
- Don't use container names in .yml file because they must be unique
1 parent 1bb10ba commit d331f33

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

control

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#! /bin/bash
22

3-
## Site specific configuration - container names. Set in .yml file.
4-
webcont=moodle
5-
dbcont=moodledb
6-
dbtestcont=moodletestdb
3+
## Change to directory of where this script is located
4+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
5+
cd $DIR;
6+
7+
## Site specific configuration - container id's for containers in this directory
8+
webcont="$(docker-compose ps -q moodle)"
9+
dbcont="$(docker-compose ps -q moodle-db)"
10+
dbtestcont="$(docker-compose ps -q moodle-test-db)"
711

812
for ARG in $*
913
do

docker-compose.yml

-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ version: '3'
22

33
services:
44
moodle:
5-
container_name: moodle
65
build: ./moodle
76
ports:
87
- "80:80"
98
volumes:
109
- ./siteroot:/siteroot
1110
moodle-db:
12-
container_name: moodledb
1311
image: postgres
1412
restart: always
1513
environment:
@@ -19,7 +17,6 @@ services:
1917
volumes:
2018
- 'moodledb:/var/lib/postgresql'
2119
moodle-test-db:
22-
container_name: moodletestdb
2320
image: postgres
2421
restart: always
2522
environment:

0 commit comments

Comments
 (0)