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:
|
create-docker-contexts:
|
||||||
@- $(foreach host,$(DEPLOY_HOSTS), \
|
@- $(foreach host,$(DEPLOY_HOSTS), \
|
||||||
docker context create $(host) --description "$(host)" --docker "host=ssh://$(SSH_USER)@$(host)"; \
|
docker context create $(host) --description "$(host)" --docker "host=ssh://$(SSH_USER)@$(host)"; \
|
||||||
|
@ -34,7 +36,6 @@ pull-swarm:
|
||||||
|
|
||||||
start-compose:
|
start-compose:
|
||||||
@- echo "\n### starting service(s)"
|
@- echo "\n### starting service(s)"
|
||||||
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
|
||||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||||
docker context use $(ctx); \
|
docker context use $(ctx); \
|
||||||
docker-compose up -d; \
|
docker-compose up -d; \
|
||||||
|
@ -49,7 +50,6 @@ start-swarm:
|
||||||
|
|
||||||
stop-compose:
|
stop-compose:
|
||||||
@- echo "\n### stopping service(s)"
|
@- echo "\n### stopping service(s)"
|
||||||
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
|
||||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||||
docker context use $(ctx); \
|
docker context use $(ctx); \
|
||||||
docker-compose down; \
|
docker-compose down; \
|
||||||
|
@ -65,20 +65,17 @@ stop-swarm:
|
||||||
|
|
||||||
logs-compose:
|
logs-compose:
|
||||||
@- echo "\n### logs"
|
@- echo "\n### logs"
|
||||||
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
|
||||||
@- docker context use $(host)
|
@- docker context use $(host)
|
||||||
@- docker-compose logs -f $(service)
|
@- docker-compose logs -f $(service)
|
||||||
@- docker context use $(stored_ctx)
|
@- docker context use $(stored_ctx)
|
||||||
|
|
||||||
logs-swarm:
|
logs-swarm:
|
||||||
@- echo "\n### logs"
|
@- echo "\n### logs"
|
||||||
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
|
||||||
@- docker context use $(DEPLOY_HOSTS)
|
@- docker context use $(DEPLOY_HOSTS)
|
||||||
@- docker service logs -f $(service)
|
@- docker service logs -f $(service)
|
||||||
@- docker context use $(stored_ctx)
|
@- docker context use $(stored_ctx)
|
||||||
|
|
||||||
restart-compose:
|
restart-compose:
|
||||||
@- stored_ctx=`docker context ls | grep "\*" | cut -d " " -f1`
|
|
||||||
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
@- $(foreach ctx,$(DEPLOY_HOSTS), \
|
||||||
docker context use $(ctx); \
|
docker context use $(ctx); \
|
||||||
docker-compose restart; \
|
docker-compose restart; \
|
||||||
|
|
Loading…
Reference in New Issue