# HOST is your Stackhero for Docker instance domain name (mxz536.stackhero-network.com).
# SERVICE_ID is your Stackhero service ID.
# CERTIFICATES_PASSWORD is the password defined in your Stackhero for Docker configuration.
(export HOST="mxz536.stackhero-network.com"
export SERVICE_ID="svc-rlaeva"
export CERTIFICATES_PASSWORD="OonfQaQerGLLsWPKmnudyghFilIcPJRW"

cd /tmp/ \
  && curl -o certificates.tar https://docker:$CERTIFICATES_PASSWORD@$HOST/stackhero/docker/certificates.tar \
  && tar -xf certificates.tar \
  && (docker context rm -f $HOST 2> /dev/null || true) \
  && docker context create $HOST \
    --description "$SERVICE_ID ($HOST)" \
    --docker "host=tcp://$HOST:2376,ca=ca.pem,cert=cert.pem,key=key.pem")