These are chat archives for docker/swarm

16th
Nov 2017
Denel Manilov
@denel-manilov
Nov 16 2017 16:00

Docker does not provide public methods for checking the status.

You can create a service that provides this opportunity like: https://github.com/crccheck/docker-hello-world

Or sending request to Docker API via SSH

#!/bin/bash
# File: docker-status.sh

if [[ ! $1 ]] || [[ ! $2 ]]; then
    echo "Usage:"
    echo "./docker-status.sh [user] [hostname]"
fi

user=$1
host=$2

status=$(ssh "$user@$host" 'curl -s --unix-socket /var/run/docker.sock "http://v1.33/_ping"')

if [[ $status = 'OK' ]]; then
    echo "$host is OK!"
    exit 0
fi

echo "Error!"

exit 1