我正在努力在我的 circleCI 配置文件中配置 MAX_CONNECTIONS
postgres 配置。正如您在下面看到的,我尝试使用 sed
替换 max_connections 值,但这没有做任何事情,max_connections 保持在默认值 100
。我还尝试运行自定义命令(请参阅下面注释的 command: |
block ),但这引发了以下错误并停止了 circleCI 进程:/docker-entrypoint.sh:第 100 行: exec: docker: 未找到退出代码 127
version: 2
jobs:
test:
pre:
- sudo sed -i 's/max_connections = 100/max_connections = 300/g' /etc/postgresql/9.6/main/postgresql.conf # Allow more than 100 connections to DB
- sudo service postgresql restart
docker:
# Specify the version you desire here
- image: circleci/node:8.11
# Setup postgres and configure the db
- image: hegand/postgres-postgis
# command: |
# docker run --name hegand/postgres-postgis -e POSTGRES_PORT=$POSTGRES_PORT POSTGRES_PASSWORD=$POSTGRES_PASSWORD POSTGRES_DB=$POSTGRES_DB -d postgres -N 300
environment:
POSTGRES_USER: user
POSTGRES_DB: table
POSTGRES_PASSWORD: ""
POSTGRES_PORT: 5432
最佳答案
在 -image
中指定命令是正确的方法。
您只需要使用命令启动 docker 容器,但在容器内运行的容器,即代替 dockerfile 中 CMD
的值。
我认为以下应该有效:
- image: hegand/postgres-postgis
command: postgres -c max_connections=300
查看 CircleCI 配置引用:https://circleci.com/docs/2.0/configuration-reference/#docker
关于postgresql - 如何更新 circleCI 配置中的 max_connections 配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52866350/