如何在官方的postgreSQL 10.0 docker镜像中增加max_connection

问题

我有太多的连接打开使用默认的dockerpostgresqlconfiguration

  • https://hub.docker.com/_/postgres/

目标

我想扩展max_connection而不使用卷来安assembly置(我需要这个在我的CI环境默认情况下是可用的)。

我试图使用sed来编辑configuration,但这没有任何作用。

什么是推荐的方式来覆盖postgresql docker官方图像的默认configuration?

这很简单(你只需要用postgres -N 500覆盖默认的CMD ):

 docker run -d --name db postgres:10 postgres -N 500 

你可以用下面的方法检查

 docker run -it --rm --link db:db postgres psql -h db -U postgres show max_connections; max_connections ----------------- 500 (1 row)