Backup and Restore
The code block under the "Backup" heading contains two small issues.
Here is the original code block taken from the page
#!/bin/bash
#Run pg_dump from the container, put it in the /tmp/ directory in the container. This is using the default password and default container name:
docker exec -w /tmp sandbox1-vectr-postgres-1 /bin/bash -c 'pg_dump -v -U vectr -d vectr' | gzip > postgres.sql.gz
#copy the file out of the container:
docker cp "postgres.sql.gz" "/your/host/location/postgres.sql.gz"
The second docker cp command isn't necessary if you redirect the output to the local machine, as is shown in the docker exec command.
If you did want to save inside the container, then the second command should be run as I show below, as you must include a container name or ID for the copy command to work successfully.
#copy the file out of the container:
docker cp sandbox1-vectr-postgres-1:/tmp/postgres.sql.gz "/your/host/location/postgres.sql.gz"
Backup and Restore
The code block under the "Backup" heading contains two small issues.
Here is the original code block taken from the page
The second
docker cpcommand isn't necessary if you redirect the output to the local machine, as is shown in thedocker execcommand.If you did want to save inside the container, then the second command should be run as I show below, as you must include a container name or ID for the copy command to work successfully.