From ba7881eea480959926d3d0168f8fdfe7e324e274 Mon Sep 17 00:00:00 2001 From: Andreas Neue Date: Mon, 18 Jul 2022 17:02:48 +0200 Subject: [PATCH] docker.mk: dont change context persistently --- docker.mk | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docker.mk b/docker.mk index b718042..f5f1275 100644 --- a/docker.mk +++ b/docker.mk @@ -1,3 +1,5 @@ +stored_ctx = `docker context ls | grep "\*" | cut -d " " -f1` + create-docker-contexts: @- $(foreach host,$(DEPLOY_HOSTS), \ docker context create $(host) --description "$(host)" --docker "host=ssh://$(SSH_USER)@$(host)"; \ @@ -34,7 +36,6 @@ pull-swarm: start-compose: @- echo "\n### starting service(s)" - @- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1` @- $(foreach ctx,$(DEPLOY_HOSTS), \ docker context use $(ctx); \ docker-compose up -d; \ @@ -49,7 +50,6 @@ start-swarm: stop-compose: @- echo "\n### stopping service(s)" - @- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1` @- $(foreach ctx,$(DEPLOY_HOSTS), \ docker context use $(ctx); \ docker-compose down; \ @@ -65,20 +65,17 @@ stop-swarm: logs-compose: @- echo "\n### logs" - @- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1` @- docker context use $(host) @- docker-compose logs -f $(service) @- docker context use $(stored_ctx) logs-swarm: @- echo "\n### logs" - @- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1` @- docker context use $(DEPLOY_HOSTS) @- docker service logs -f $(service) @- docker context use $(stored_ctx) restart-compose: - @- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1` @- $(foreach ctx,$(DEPLOY_HOSTS), \ docker context use $(ctx); \ docker-compose restart; \