I am trying to restore database in PostgreSQL docker container using pg_restore from a shellscript taht will be called from docker file .I am getting following error \"E
Here is a way to restore from a file located on the host machine:
docker exec -i container_name pg_restore -U postgres_user -v -d database_name < /dir_backup_outside_container/file_name.tar
I don't think the backup restore can be done during the initialization phase. Start your container and then upload the db.
docker run -d --name mydb mypgimage
docker exec mydb sh -c "pg_restore -C -d DB /var/lib/postgresql/backup/DB.backup"