Check that Docker is in Swarm mode

This commit updates deploy_stack.ps1 to check that Docker is running in
Swarm mode before proceeding.

Signed-off-by: John McCabe <john@johnmccabe.net>
This commit is contained in:
John McCabe 2018-10-20 03:50:05 +01:00 committed by Alex Ellis
parent 8d041efd0c
commit 7d5955b6f2

View File

@ -2,7 +2,9 @@
if (Get-Command docker -errorAction SilentlyContinue)
{
docker node ls 2>&1 | out-null
if($?)
{
$user_secret = "basic-auth-user"
docker secret inspect $user_secret 2>&1 | out-null
if($?)
@ -29,6 +31,12 @@ if (Get-Command docker -errorAction SilentlyContinue)
Write-Host "Deploying stack"
docker stack deploy func --compose-file ./docker-compose.yml
}
else
{
Write-Host "Docker not in swarm mode, please initialise the cluster (`docker swarm init`) and retry"
}
}
else
{