-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow "initdb.d" scripts to be (optionally) sourced instead of executed #490
Comments
If you remove the executable bit from your Line 148 in 91939da
|
(As in, this is working as designed, and I'm not sure I understand how/why it's difficult to maintain a |
Related #452 |
Ah, one simple workaround could be to mount it somewhere else, and adjust your db:
image: postgres:10
command: sh -c 'cp /tmp/xyz.sh /docker-entrypoint-initdb.d/ && chmod -x /docker-entrypoint-initdb.d/xyz.sh && exec docker-entrypoint.sh postgres'
volumes:
- ./xyz.sh:/tmp/xyz.sh:ro |
That's a better workaround indeed. Still, it seems like many (most?) users would want access to the environment of If nobody else agrees, though, I can live with the workaround :) |
@tianon Unless I'm mistaken, for that workaround the entrypoint needs to be changed (from |
I mean, you can, but it will automatically ignore this command and pass it
straight through (since "$1" isn't "postgres"), so it's harmless either way
(and more readable this way than munging "entrypoint:" too, IMO).
|
Ah, that's what it does. I was confused I think, I didn't re-run docker_entrypoint! |
Kind-of the opposite of #452 (which fixes #450), but I'd be fine with the current behavior by default provided there can be some means (file name or extension) of sourcing instead of executing.
Rationale:
I have an initialization script that needs
file_env()
,$POSTGRES_DB
, and${psql[@]}
.When the script is
source
d it works, but as none of those areexport
ed, it doesn't work if it's executed. We've had to take care tochmod -x
the file to work around this after #452, but that seems kind-of hacky and hard to maintain.Possible options:
source_*.sh
,*.source.sh
,.*
, or similar$f
instead of ignoring itThoughts?
The text was updated successfully, but these errors were encountered: