From b20c1342320858b315874800c37f7ae7946922ac Mon Sep 17 00:00:00 2001 From: Nathan Jones Date: Thu, 18 Apr 2019 20:11:56 -0400 Subject: [PATCH] Added examples (#8599) * Added examples Added examples with more detail and automation to help customers backup DTR without creating support tickets. * Linked to explanation of example command @omegamormegil I removed the example with prepopulated fields, as I think it doesn't add much, and will only add confusion. Users who need this much detail can run the basic command and follow the terminal prompts. We can re-add in a follow-up PR, if you think that example is crucial to this page. --- reference/dtr/2.6/cli/backup.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/reference/dtr/2.6/cli/backup.md b/reference/dtr/2.6/cli/backup.md index 4be9f3fda9..277ed862c9 100644 --- a/reference/dtr/2.6/cli/backup.md +++ b/reference/dtr/2.6/cli/backup.md @@ -15,12 +15,37 @@ docker run -i --rm docker/dtr \ backup [command options] > backup.tar ``` -### Example Usage +### Example Commands + +#### Basic ```bash -docker run -i --rm docker/dtr \ +docker run -i --rm --log-driver none docker/dtr:{{ page.dtr_version }} \ backup --ucp-ca "$(cat ca.pem)" --existing-replica-id 5eb9459a7832 > backup.tar ``` +### Advanced (with chained commands) +```bash +DTR_VERSION=$(docker container inspect $(docker container ps -f \ + name=dtr-registry -q) | grep -m1 -Po '(?<=DTR_VERSION=)\d.\d.\d'); \ +REPLICA_ID=$(docker ps --filter name=dtr-rethinkdb \ + --format "{{ .Names }}" | head -1 | sed 's|.*/||' | sed 's/dtr-rethinkdb-//'); \ +read -p 'ucp-url (The UCP URL including domain and port): ' UCP_URL; \ +read -p 'ucp-username (The UCP administrator username): ' UCP_ADMIN; \ +read -sp 'ucp password: ' UCP_PASSWORD; \ +docker run --log-driver none -i --rm \ + --env UCP_PASSWORD=$UCP_PASSWORD \ + docker/dtr:$DTR_VERSION backup \ + --ucp-username $UCP_ADMIN \ + --ucp-url $UCP_URL \ + --ucp-ca "$(curl https://${UCP_URL}/ca)" \ + --existing-replica-id $REPLICA_ID > \ + dtr-metadata-${DTR_VERSION}-backup-$(date +%Y%m%d-%H_%M_%S).tar +``` + +For a detailed explanation on the advanced example, see +[Back up your DTR metadata](ee/dtr/admin/disaster-recovery/create-a-backup/#back-up-dtr-metadata). +To learn more about the `--log-driver` option for `docker run`, see [docker run reference](/engine/reference/run/#logging-drivers---log-driver). + ## Description This command creates a `tar` file with the contents of the volumes used by