mailcow/011-build-memcached.sh

27 lines
644 B
Bash
Raw Normal View History

2016-12-10 03:39:02 +08:00
#!/bin/bash
. mailcow.conf
NAME="memcached-mailcow"
echo "Stopping and removing containers with name tag ${NAME}..."
if [[ ! -z $(docker ps -af "name=${NAME}" -q) ]]; then
docker stop $(docker ps -af "name=${NAME}" -q)
docker rm $(docker ps -af "name=${NAME}" -q)
fi
if [[ ! -z "$(docker images -q rmilter)" ]]; then
2016-12-10 03:52:19 +08:00
read -r -p "Found image locally. Delete local image and repull? [y/N] " response
2016-12-10 03:39:02 +08:00
response=${response,,}
if [[ $response =~ ^(yes|y)$ ]]; then
docker rmi memcached
fi
fi
docker run \
--network=${DOCKER_NETWORK} \
-h memcached \
--network-alias=memcached \
2016-12-10 03:39:02 +08:00
--name=${NAME} \
-d memcached