From 79dc45279905d7e372bc6fe1e34bdd9a252b6e9e Mon Sep 17 00:00:00 2001 From: hygienic-books Date: Wed, 21 Jun 2023 00:27:23 +0200 Subject: [PATCH] docs(docker-compose): Handle remote deployment via --context --- docker-compose/examples/grafana/README.md | 9 ++++++++- docker-compose/examples/hashicorpvault/README.md | 9 ++++++++- .../{{ cookiecutter.__project_slug }}/README.md | 11 +++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docker-compose/examples/grafana/README.md b/docker-compose/examples/grafana/README.md index 9b84669..f261742 100644 --- a/docker-compose/examples/grafana/README.md +++ b/docker-compose/examples/grafana/README.md @@ -17,10 +17,17 @@ export COMPOSE_FILE="${COMPOSE_DIR}"'/docker-compose.yml' export COMPOSE_ENV= ``` +## Context + +On your deployment machine create the necessary Docker context to connect to and control the Docker daemon on whatever target host you'll be using, for example: +``` +docker context create fully.qualified.domain.name --docker 'host=ssh://root@fully.qualified.domain.name' +``` + ## Start ``` -docker compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" --profile 'full' up --detach +docker --context 'fully.qualified.domain.name' compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" --profile 'full' up --detach ``` # Initial setup diff --git a/docker-compose/examples/hashicorpvault/README.md b/docker-compose/examples/hashicorpvault/README.md index 47d4776..613c83f 100644 --- a/docker-compose/examples/hashicorpvault/README.md +++ b/docker-compose/examples/hashicorpvault/README.md @@ -24,10 +24,17 @@ export COMPOSE_ENV= docker compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --file "${COMPOSE_OVERRIDE}" --env-file "${COMPOSE_ENV}" --profile 'build' build ``` +## Context + +On your deployment machine create the necessary Docker context to connect to and control the Docker daemon on whatever target host you'll be using, for example: +``` +docker context create fully.qualified.domain.name --docker 'host=ssh://root@fully.qualified.domain.name' +``` + ## Start ``` -docker compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" up --detach +docker --context 'fully.qualified.domain.name' compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" up --detach ``` # Initial setup diff --git a/docker-compose/{{ cookiecutter.__project_slug }}/README.md b/docker-compose/{{ cookiecutter.__project_slug }}/README.md index 4022168..c6142aa 100644 --- a/docker-compose/{{ cookiecutter.__project_slug }}/README.md +++ b/docker-compose/{{ cookiecutter.__project_slug }}/README.md @@ -27,13 +27,20 @@ docker compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --fi ``` {%- endif %} +## Context + +On your deployment machine create the necessary Docker context to connect to and control the Docker daemon on whatever target host you'll be using, for example: +``` +docker context create fully.qualified.domain.name --docker 'host=ssh://root@fully.qualified.domain.name' +``` + ## Start ``` {%- if ',' in cookiecutter.__component_list_slug %} -docker compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" --profile 'full' up --detach +docker --context 'fully.qualified.domain.name' compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" --profile 'full' up --detach {%- else %} -docker compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" up --detach +docker --context 'fully.qualified.domain.name' compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" up --detach {%- endif %} ```