From 0436224728382b4188888d4806a478c4fc036293 Mon Sep 17 00:00:00 2001 From: hygienic-books Date: Sat, 24 Jun 2023 23:57:02 +0200 Subject: [PATCH] docs(docker-compose): Add paragraph to copy image to target server --- docker-compose/examples/grafana/README.md | 11 +++++++++++ docker-compose/examples/hashicorpvault/README.md | 9 +++++++++ .../{{ cookiecutter.__project_slug }}/README.md | 16 ++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/docker-compose/examples/grafana/README.md b/docker-compose/examples/grafana/README.md index 7586b8d..2a453f0 100644 --- a/docker-compose/examples/grafana/README.md +++ b/docker-compose/examples/grafana/README.md @@ -36,6 +36,17 @@ Pull images from Docker Hub verbatim. docker compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" --profile 'full' pull ``` +## Copy to target + +Copy images to target Docker host, that is assuming you deploy to a machine that itself has no network route to reach Docker Hub. Copying in its simplest form involves a local `docker save` and a remote `docker load`. Consider the helper mini-project [quico.space/Quico/copy-docker](https://quico.space/Quico/copy-docker) where [copy-docker.sh](https://quico.space/Quico/copy-docker/src/branch/main/copy-docker.sh) allows the following workflow: + +``` +source "${COMPOSE_ENV}" +for image in 'grafana:'"${GRAFANA_VERSION}" 'nginx:'"${NGINX_VERSION}"; do + copy-docker.sh "${image}" fully.qualified.domain.name +done +``` + ## Start ``` diff --git a/docker-compose/examples/hashicorpvault/README.md b/docker-compose/examples/hashicorpvault/README.md index 49a4cb6..b0fea91 100644 --- a/docker-compose/examples/hashicorpvault/README.md +++ b/docker-compose/examples/hashicorpvault/README.md @@ -44,6 +44,15 @@ FIXME Rewrite either [Build](#build) or this paragraph for which images are buil docker compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" --profile 'full' pull ``` +## Copy to target + +Copy images to target Docker host, that is assuming you deploy to a machine that itself has no network route to reach Docker Hub. Copying in its simplest form involves a local `docker save` and a remote `docker load`. Consider the helper mini-project [quico.space/Quico/copy-docker](https://quico.space/Quico/copy-docker) where [copy-docker.sh](https://quico.space/Quico/copy-docker/src/branch/main/copy-docker.sh) allows the following workflow: + +``` +source "${COMPOSE_ENV}" +copy-docker.sh 'vault':"${VAULT_VERSION}" fully.qualified.domain.name +``` + ## Start ``` diff --git a/docker-compose/{{ cookiecutter.__project_slug }}/README.md b/docker-compose/{{ cookiecutter.__project_slug }}/README.md index 338433e..dd9ef6e 100644 --- a/docker-compose/{{ cookiecutter.__project_slug }}/README.md +++ b/docker-compose/{{ cookiecutter.__project_slug }}/README.md @@ -53,6 +53,22 @@ docker compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --fi docker compose --project-name "${COMPOSE_PROJECT}" --file "${COMPOSE_FILE}" --env-file "${COMPOSE_ENV}" --profile 'full' pull ``` +## Copy to target + +Copy images to target Docker host, that is assuming you deploy to a machine that itself has no network route to reach Docker Hub. Copying in its simplest form involves a local `docker save` and a remote `docker load`. Consider the helper mini-project [quico.space/Quico/copy-docker](https://quico.space/Quico/copy-docker) where [copy-docker.sh](https://quico.space/Quico/copy-docker/src/branch/main/copy-docker.sh) allows the following workflow: + +``` +source "${COMPOSE_ENV}" +{%- set components = cookiecutter.__component_list_slug.split(',') -%} +{%- if ',' in cookiecutter.__component_list_slug %} +for image in{% for component in components %} '{{ component }}:'"${% raw %}{{% endraw %}{{ component.upper() }}_VERSION{% raw %}}{% endraw %}"{%- endfor %}; do + copy-docker.sh "${image}" fully.qualified.domain.name +done +{%- else %} +copy-docker.sh '{{ cookiecutter.__component_list_slug }}':"${% raw %}{{% endraw %}{{ cookiecutter.__component_list_slug.upper() }}_VERSION{% raw %}}{% endraw %}" fully.qualified.domain.name +{%- endif %} +``` + ## Start ```