Backup: | |
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql | |
Restore: | |
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres |
This comment has been minimized.
This comment has been minimized.
Missing whitespace in restore command between "-U" and "postgres" |
This comment has been minimized.
This comment has been minimized.
To restore your dump file with specified
|
This comment has been minimized.
This comment has been minimized.
I am getting a lot of these when I try to restore: |
This comment has been minimized.
This comment has been minimized.
Ao fazer isso: Obtive o seguinte erro: |
This comment has been minimized.
This comment has been minimized.
@romulo-soares You need to use sudo before docker if you are not root (tens de usar sudo se não estás logado com root):
|
This comment has been minimized.
This comment has been minimized.
Hello, you can use the user that has permissions to run docker commands and not root. |
This comment has been minimized.
This comment has been minimized.
if you provided a label (i.e. foo=bar) you can also use the following (useful for autobackup in a cron script): |
This comment has been minimized.
This comment has been minimized.
im getting
when trying to run |
This comment has been minimized.
This comment has been minimized.
This is pretty helpful |
This comment has been minimized.
This comment has been minimized.
can i load data in dockerfile? |
This comment has been minimized.
This comment has been minimized.
@rluts When creating dockerized containers, there are typically intermediate containers that do not persist any data into the next step of building. See this Stack Overflow question and accepted answer for an example. With that said, after building your image, what you can do is import the data using the method proposed by @ChunAllen: After importation, create an image of that container, which will have a copy of your data. I was able to accomplish this using a dump file that was ~85 Gb's :) |
This comment has been minimized.
This comment has been minimized.
for pg_restore
|
This comment has been minimized.
This comment has been minimized.
When I do
all I get is Can someone help me, I new to I know the |
This comment has been minimized.
This comment has been minimized.
Thx for a restore command :) |
This comment has been minimized.
This comment has been minimized.
@eduardorr97: I think you need to place the file within the container (e.g. via a volume). |
This comment has been minimized.
This comment has been minimized.
this problem: |
This comment has been minimized.
This comment has been minimized.
Hey thanks for the reply, I actually remember solving this by using a different command than |
This comment has been minimized.
This comment has been minimized.
@eduadorr97: actually it would also be possible to keep the |
This comment has been minimized.
As explained in this article: http://durandom.de/docker/postgres/2016/12/20/pg_dump/ you should not pass
-t
to docker exec to backup your DB.