docker.mk: dont change context persistently
This commit is contained in:
parent
b24062bfc3
commit
ba7881eea4
|
@ -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; \
|
||||
|
|
Loading…
Reference in New Issue