-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpmyadmin.start
More file actions
executable file
·48 lines (39 loc) · 1.53 KB
/
phpmyadmin.start
File metadata and controls
executable file
·48 lines (39 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Update GitHub with any changes to Docker scripts.
/home/ryan/scripts/docker/_update_git.sh
# Get sensitive info from .conf file
CONF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
typeset -A secrets # Define array to hold variables
while read line; do
if echo $line | grep -F = &>/dev/null; then
varname=$(echo "$line" | cut -d '=' -f 1); secrets[$varname]=$(echo "$line" | cut -d '=' -f 2-)
fi
done < $CONF_DIR/phpmyadmin.conf
echo ${secrets[FQDN]}
NAME=phpmyadmin
FQDN="${secrets[FQDN]}"
docker stop $NAME
docker rm -f -v $NAME
# Create container, then add to traefik-proxy network, then start it to make sure it has access to it's 'normal' network
# We use 'docker create' to create the container, then 'docker network connect' to add the container to traefik-proxy,
# then 'docker start' to startup the container.
# Also '-d' not needed with 'docker create' since 'docker start' sutomatically starts in detached mode.
#docker run -d \
docker create \
--name $NAME \
--restart="unless-stopped" \
--link mariadb:db \
-e PMA_PORT=3306 \
-p 3307:80 \
`# ------- Traefik Proxy Section -------` \
`#--network traefik-proxy` \
-l "traefik.enable=false" \
-l "traefik.port=80" \
-l "traefik.frontend.rule=Host:$NAME.$FQDN" \
`# -------------------------------------` \
phpmyadmin/phpmyadmin
# Add to bridge & traefik-proxy network so it can reach the other container
docker network connect bridge $NAME
docker network connect traefik-proxy $NAME
# Start container
docker start $NAME