[英]How do I run a Postgres query inside my docker container?
I'm using a Windows machine with Postgres 9.5 installed.我正在使用安装了 Postgres 9.5 的 Windows 机器。 I've also got a Docker container.
我还有一个 Docker 容器。 I need to run an sql file located specifically inside my docker container, and it's supposed to run the query on Window's Postgres.
我需要运行一个 sql 文件,该文件专门位于我的 docker 容器内,它应该在 Window 的 Postgres 上运行查询。
How can I do this either using my docker file or my init.sh file (which is called from the docker file).如何使用我的 docker 文件或我的 init.sh 文件(从 docker 文件调用)来执行此操作。
According to the discussion, the main problem is the connection timeout, and we can increase the connection timeout.根据讨论,主要问题是连接超时,我们可以增加连接超时。
See the official documentation https://www.postgresql.org/docs/9.6/runtime-config-client.html见官方文档https://www.postgresql.org/docs/9.6/runtime-config-client.html
Here is an example of it working这是它工作的一个例子
SET statement_timeout = 10000;
SET
test=# SELECT pg_sleep(15);
ERROR: canceling statement due to statement timeout
for more info, you can have a look to this: https://dba.stackexchange.com/questions/164419/is-it-possible-to-limit-timeout-on-postgres-server有关更多信息,您可以查看以下内容: https://dba.stackexchange.com/questions/164419/is-it-possible-to-limit-timeout-on-postgres-server
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.