Skip to content
Snippets Groups Projects

Resolve "Docker pull before eos-docker stop"

Merged Martin Vala requested to merge 39-docker-pull-before-eos-docker-stop into master
3 files
+ 43
2
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -89,6 +89,9 @@ cat > $ED_ROOT_DIR/$ED_CONFIG_FILE.simple << EOF
#!/bin/bash
# EOS docker generated config $(date)
# EOS DOCKER version
export ED_DOCKER_IMAGE_NAME_VERSION="$ED_DOCKER_IMAGE_NAME_VERSION"
# EOS
export ED_EOS_INSTANCE_NAME="test"
@@ -107,6 +110,9 @@ cat > $ED_ROOT_DIR/$ED_CONFIG_FILE.alice << EOF
#!/bin/bash
# EOS docker for ALICE generated config $(date)
# EOS DOCKER version
export ED_DOCKER_IMAGE_NAME_VERSION="$ED_DOCKER_IMAGE_NAME_VERSION"
# EOS
export ED_EOS_INSTANCE_NAME="alice.test"
@@ -215,6 +221,25 @@ function eosDockerRun() {
fi
}
function eosDockerPull() {
for t in $*;do
DEBUG "Pulling $t ..."
if [ "$t" == "mgm" -o "$t" == "_single" ];then
INFO "Pulling docker '$ED_DOCKER_PREFIX/$ED_DOCKER_IMAGE_NAME_VERSION' ..."
$ED_DOCKER_CMD pull $ED_DOCKER_PREFIX/$ED_DOCKER_IMAGE_NAME_VERSION
elif [ "$t" == "fsts" ];then
[[ $ED_NODE_TYPE == mgm* ]] && [ -f $ED_ROOT_DIR/$ED_FST_HOSTS ] && eos-docker-ssh pull
elif [ "$t" == "host" ];then
[[ $ED_NODE_TYPE == mgm* ]] && eos-docker-ssh pull $ED_HOSTS_HOST
fi
done
return 0
}
function eosDockerStart() {
for t in $*;do
@@ -289,13 +314,16 @@ function eosDockerUpdate() {
for t in $*;do
DEBUG "Updating $t ..."
if [ "$t" == "mgm" -o "$t" == "_single" ];then
eosDockerPull $t
eosDockerClean $t
eosDockerCleanDocker
eosDockerStart $t
elif [ "$t" == "fsts" ];then
eosDockerPull $t
eosDockerClean $t
eosDockerStart $t
elif [ "$t" == "host" ];then
eosDockerPull $t
eosDockerClean $t
eosDockerStart $t
fi
@@ -383,7 +411,11 @@ function eosDockerFirewallPrint() {
function eosDockerCleanDocker() {
$ED_DOCKER_CMD stop $($ED_DOCKER_CMD ps --format "{{.Names}}" | grep eos-)> /dev/null 2>&1
$ED_DOCKER_CMD rm $($ED_DOCKER_CMD ps --format "{{.Names}}" | grep eos-)> /dev/null 2>&1
$ED_DOCKER_CMD rmi -f $($ED_DOCKER_CMD images --format "{{.ID}}" --filter=reference=$ED_DOCKER_PREFIX/$ED_DOCKER_IMAGE_NAME_VERSION) > /dev/null 2>&1
for d in $($ED_DOCKER_CMD images --format "{{.ID}}_{{.Repository}}:{{.Tag}}" --filter=reference=$ED_DOCKER_PREFIX/$(echo $ED_DOCKER_IMAGE_NAME_VERSION | cut -d ':' -f1) | grep -v $ED_DOCKER_PREFIX/$ED_DOCKER_IMAGE_NAME_VERSION); do
INFO "Removing image '$d' ..."
img=$(echo "$d" | cut -d '_' -f1)
$ED_DOCKER_CMD rmi -f $img > /dev/null 2>&1
done
}
function eosDockerEnter() {
@@ -592,6 +624,7 @@ else
exit 1
fi
export ED_TYPE=$(readlink -f $ED_ROOT_DIR/$ED_CONFIG_FILE | cut -d. -f3)
[ -z $ED_MONITORING ] && export ED_MONITORING=0
@@ -633,6 +666,9 @@ case "$1" in
INFO "Init of EOS docker '$ED_TYPE' done ..."
exit $?
;;
pull)
eosDockerPull $ED_HOSTS_TYPES
;;
start)
eosDockerStart $ED_HOSTS_TYPES
;;
Loading