-
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
Functionalize the entrypoint to allow outside sourcing for extreme customizing of startup #496
Conversation
I wonder if it'd make sense to namespace our functions to be more considerate of other functions folks might be using -- something like FYI @ltangvald (this is probably relevant to your interests for docker-library/mysql#471 -- it'd be great if we could get both using a similar approach ❤️) |
Yeah, makes sense. Prefixing everything with docker_ sounds good to me :) |
I really miss support for Many times one needs to ensure some DB configurations state, no matter if the DB existed previously or not. Do you think this is a good chance to tackle that? |
@yajo, the example I show for possible user customization includes exactly that and allows for all sorts of other customization. |
Yeah, I see, but your suggestion is to override the entrypoint AFAICS, but I was referring to supporting that kind of exec scripts in the official entrypoint. Sometimes you need to override the default entrypoint behavior, but sometimes it's just simpler to drop a script and let it be executed before booting postgres. A simple example that I have currently at hand: autofill of |
Any update on this? Our use case is very similar to that of @yajo |
cd52b6f
to
0e45b71
Compare
Left out applying |
…stomizing of startup
add `DATABASE_ALREADY_EXISTS` variable
2cfa336
to
7c84645
Compare
Changes: - docker-library/postgres@5beb1d4: Update to 9.4.25-1.pgdg90+1 - docker-library/postgres@a0ec4f5: Update to 9.5.20 - docker-library/postgres@6dfdc0e: Update to 11.6 - docker-library/postgres@2addeda: Update to 11.6-1.pgdg90+1 - docker-library/postgres@f13fbe5: Update to 9.6.16-1.pgdg90+1 - docker-library/postgres@f2596e6: Update to 10.11-1.pgdg90+1 - docker-library/postgres@c1e547b: Update to 10.11 - docker-library/postgres@cac7a60: Update to 9.6.16 - docker-library/postgres@1d43a9d: Update to 12.1 - docker-library/postgres@06a831c: Update to 9.5.20-1.pgdg90+1 - docker-library/postgres@138e959: Update to 9.4.25 - docker-library/postgres@4a82eb9: Update to 12.1-1.pgdg100+1 - docker-library/postgres@0c29c35: Merge pull request docker-library/postgres#496 from infosiftr/functionalization - docker-library/postgres@8fada98: Fixes from tianon's review - docker-library/postgres@7c84645: Apply update.sh for new entrypoint - docker-library/postgres@d1cc089: Improve _is_sourced check - docker-library/postgres@6e85168: Resync function interfaces with MySQL, improve comments - docker-library/postgres@2e70e71: Apply function name changes as discussed in docker-library/mysql#471 - docker-library/postgres@49fb876: Namespace functions for less conflict when sourced - docker-library/postgres@48f2ad1: Functionalize the entrypoint to allow outside sourcing for extreme customizing of startup
Hi @yosifkit I'm following this reference for a custom entry point to cache the database I create. I've below command in my Dockerfile
However when it run the
I've removed that exec command from custom-entrypoint.sh, and moved to Dockerfile as below, And that seems to be working. But not sure that's the ideal way to do this ? Highly appreciate your thoughs
|
@Chanaka, yeah you only need the It depends on how you expect to use the custom entrypoint script. If you plan on allowing running things that aren't For your use case, you'll probably need to set |
@yosifkit I also had the chanaka's issue so I followed your instrauctions. My build step hangs with below logs
I don't run the image yet. I only need the images created and tagged so I can run them later.I have other stuff needs to happen after database image creation. But currently it seems container starts and stays there. How can I resolve this ? |
If you are running the entrypoint in a |
This will allow a user to write a script to use our script as a base for their own postgres startup.
We need to ensure that that we define the set of functions that users can call. Currently that is any function that doesn't start with an underscore (listed below):
EDIT: example updated (and tested) with an example
docker run
.Here is an example using the current interface to run other init scripts on every start:
Closes #463, closes #461
EDIT: Threading the needle; related to docker-library/rabbitmq#281
EDIT: applied new function names from discussion and nearing completion of docker-library/mysql#471 (rebased commits incoming)