Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-entrypoint-initdb.d but ran at every container start? #295

Closed
leoc opened this issue Jun 1, 2017 · 1 comment
Closed

docker-entrypoint-initdb.d but ran at every container start? #295

leoc opened this issue Jun 1, 2017 · 1 comment

Comments

@leoc
Copy link

leoc commented Jun 1, 2017

Hi,

I want to ensure at any start of postgres container, that a custom setting is set from enviroment variable from my docker-compose file.

I thought docker-entrypoint-initdb.d would be the way to go, but if I have a volume for the pg data initialized already, than these scripts are not executed.

I have a script like this:

#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
SET my.node_id = $MY_NODE_ID;
ALTER SYSTEM SET my.node_id = $MY_NODE_ID;
SELECT pg_reload_conf();
EOSQL

And a docker-compose.yml like this:

postgres:
  image: postgres:9.5
  volumes:
    - ./postgresql_data:/var/lib/postgresql/data
    - ./script/postgres_configure_node_id.sh:/docker-entrypoint-initdb.d/configure-node-id.sh
  environment:
    ERICA_NODE_ID: 1

Would you merge a pull request, that would lead to execution of everything in, let's say, /docker-entrypoint-start.d when the docker container starts?

@yosifkit
Copy link
Member

Duplcate #191
Related to docker-library/mysql#304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants