diff --git a/src/entrypoint.sh b/src/entrypoint.sh index a6a45ad..a915697 100755 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -94,7 +94,7 @@ gantry() { log DEBUG "Set NODE_NAME=${RUN_ON_NODE}" export NODE_NAME="${RUN_ON_NODE}" fi - log INFO "Run on Docker host ${RUN_ON_NODE}. $(docker --version 2>&1)" + log INFO "Run on Docker host ${RUN_ON_NODE}. $(docker_version)" local ACCUMULATED_ERRORS=0 diff --git a/src/lib-common.sh b/src/lib-common.sh index 3bbb0b3..bc6b9a8 100755 --- a/src/lib-common.sh +++ b/src/lib-common.sh @@ -409,6 +409,15 @@ wait_service_state() { return "${RETURN_VALUE}" } +docker_version() { + local cver capi sver sapi + if ! cver=$(docker version --format '{{.Client.Version}}' 2>&1); then log ERROR "${cver}"; cver="error"; fi + if ! capi=$(docker version --format '{{.Client.APIVersion}}' 2>&1); then log ERROR "${capi}"; capi="error"; fi + if ! sver=$(docker version --format '{{.Server.Version}}' 2>&1); then log ERROR "${sver}"; sver="error"; fi + if ! sapi=$(docker version --format '{{.Server.APIVersion}}' 2>&1); then log ERROR "${sapi}"; sapi="error"; fi + echo "Docker version client ${cver} (API ${capi}) server ${sver} (API ${sapi})" +} + docker_service_remove() { local SERVICE_NAME="${1}" if ! docker service inspect --format '{{.JobStatus}}' "${SERVICE_NAME}" >/dev/null 2>&1; then diff --git a/src/lib-gantry.sh b/src/lib-gantry.sh index e0d1235..51bb02b 100755 --- a/src/lib-gantry.sh +++ b/src/lib-gantry.sh @@ -344,7 +344,7 @@ _remove_container() { gantry_remove_images() { local IMAGES_TO_REMOVE="${1}" local IMAGE RMI_MSG - docker --version 2>&1 | log_lines DEBUG + log DEBUG "$(docker_version)" for IMAGE in ${IMAGES_TO_REMOVE}; do if ! docker image inspect "${IMAGE}" 1>/dev/null 2>&1 ; then log DEBUG "There is no image ${IMAGE} on the node.";