postgres how to copy table from one database to another code example
Example 1: postgres copy table from one schema to another
create table schema2.the_table (like schema1.the_table including all);
insert into schema2.the_table
select *
from schema1.the_table;
Example 2: copy data from one postgres container to another
docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
cat your_dump.sql | docker exec -i your-db-container psql -U postgres