Skip to content

Commit

Permalink
Print both docker client and server versions
Browse files Browse the repository at this point in the history
  • Loading branch information
shizunge committed Oct 8, 2024
1 parent 751c4a1 commit b4f8501
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions src/lib-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/lib-gantry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.";
Expand Down

0 comments on commit b4f8501

Please sign in to comment.