From e295ddb778fbd76ee4ba96643b05392ab632255b Mon Sep 17 00:00:00 2001 From: Mike97M Date: Wed, 14 Jul 2021 16:06:38 +0300 Subject: [PATCH] Backup - get container ID automatically from docker-compose Backup documentation to show how to use "docker-compose -f local.yml ps -q postgres" to get the container ID instead of hard coding it. --- docs/docker-postgres-backups.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/docker-postgres-backups.rst b/docs/docker-postgres-backups.rst index 6ccb7cf1..875d737e 100644 --- a/docs/docker-postgres-backups.rst +++ b/docs/docker-postgres-backups.rst @@ -55,8 +55,11 @@ With a single backup file copied to ``.`` that would be :: $ docker cp 9c5c3f055843:/backups/backup_2018_03_13T09_05_07.sql.gz . -.. _`command`: https://docs.docker.com/engine/reference/commandline/cp/ +You can also get the container ID using ``docker-compose -f local.yml ps -q postgres`` so if you want to automate your backups, you don't have to check the container ID manually every time. Here is the full command :: + $ docker cp $(docker-compose -f local.yml ps -q postgres):/backups ./backups + +.. _`command`: https://docs.docker.com/engine/reference/commandline/cp/ Restoring from the Existing Backup ----------------------------------