使用wal-e从WAL备份postgresql docker镜像

我有一个安装了沃尔 – 安装和工作的图像。 它成功地在backup-push发送我的WAL到远程驱动器。

但是,当我运行backup-fetch ,我得到的错误

 wal_e.main INFO MSG: starting WAL-E DETAIL: The subcommand is "backup-fetch". STRUCTURED: time=2017-09-05T07:45:24.721673-00 pid=3839 wal_e.main ERROR MSG: attempting to overwrite a live data directory DETAIL: Found a postmaster.pid lockfile, and aborting HINT: Shut down postgres. If there is a stale lockfile, then remove it after being very sure postgres is not running. STRUCTURED: time=2017-09-05T07:45:24.750882-00 pid=3839 

所以我按照错误,并closures与pg_ctl stop ,我得到:

 pg_ctl: cannot be run as root Please log in (using, eg, "su") as the (unprivileged) user that will own the server process. 

然后我移动到另一个closures方法pkill postgres

当我这样做似乎在closurespostgres工作,但然后踢我的容器,并运行重新启动协议。

要解决这个问题,我可以摆脱restart:always在我的撰写文件,但我不想这样做,因为它提出了我的编排完整性的问题。

有关如何使用wal-e在postgresql docker映像上从WAL进行恢复的其他想法?

编辑:

我也试过跑步

 docker exec -t postgres_1 pkill postgres; /usr/bin/envdir /etc/wal-ed/env /usr/local/bin/wal-e backup-fetch /var/lib/postgresql/data LATEST 

这在理论上会停下来,然后一举恢复,但它做到了我所期望的。 停止重新启动容器,然后返回预期的错误:

-bash: /usr/bin/envdir: No such file or directory