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

"Init only" flag for startup #192

Closed
danquah opened this issue Jul 30, 2018 · 6 comments
Closed

"Init only" flag for startup #192

danquah opened this issue Jul 30, 2018 · 6 comments
Labels
question Usability question, not directly related to an error with the image Request Request for image modification or feature

Comments

@danquah
Copy link

danquah commented Jul 30, 2018

Question as much as a feature-request:

Would you accept a PR that introduced a flag for docker-entrypoint.sh that would cause it to only do and initialisation and then quit?

We currently run a forked version of this image that does this by having last exec "$@" line (https://github.com/docker-library/mariadb/blob/befa40c64b4a51b012fb432a3cf9e08e88f9b263/10.3/docker-entrypoint.sh#L190) removed. We use the image for importing a nightly database-dump into mariadb, and then export /var/lib/mysql into a data-only image which our developers then can mount when doing support work. The script that does this simply starts up the image with a /var/lib/mysql volume mounted, waits for it to exit successfully, and then starts up another image with the same volume mounted that does the export.

This method gives us a very short startup time as compared to doing a full sql-import, and it really helps for larger database dumps.

Apart from our use case I guess the same solution could be used for a simple test of the integrity of a dump. Set the flag, start up the container, and if it exists successfully it was able to do the import without any issues.

As mentioned our current solution is a fork with a very crude fix, but I'll be happy to implement a more clean configurable solution with eg. an environment variable for switching on the behaviour.

@wglambert wglambert added question Usability question, not directly related to an error with the image Request Request for image modification or feature labels Jul 30, 2018
@danquah
Copy link
Author

danquah commented Jul 31, 2018

Quick example of how it could look: master...reload:init-only-entrypoint

@tianon
Copy link
Contributor

tianon commented Jul 31, 2018

This is related to docker-library/mysql#357 and docker-library/mysql#423.

I think my own preference would be to fully implement what docker-library/mysql#402 started, as noted/discussed in docker-library/mysql#416.

I definitely don't think a new environment variable is a great approach here and would rather have a custom script/command that can be explicitly invoked for folks who want this behavior.

@danquah
Copy link
Author

danquah commented Aug 1, 2018

I of cause completely forgot to check /mysql for similar issues, they are indeed very related to say the least (docker-library/mysql#423 is identical down to the suggested solution).

You're thinking that if the deamon was invoked via a function - it would be possible for a init-script to override that function before it is called and replace it with a noop?

How does the development of these two (mariadb/mysql) work - would the work have to be done over in mysql first, or is it ok to do a PR here in mariadb?

@tianon
Copy link
Contributor

tianon commented Aug 27, 2018

You're thinking that if the deamon was invoked via a function - it would be possible for a init-script to override that function before it is called and replace it with a noop?

The idea would be that if all you want is initdb, you'd simply invoke the initdb behavior and ignore the daemon startup completely.

How does the development of these two (mariadb/mysql) work - would the work have to be done over in mysql first, or is it ok to do a PR here in mariadb?

Generally, we don't like to merge anything here without first discussing/implementing it over there unless there's a compelling reason that the two would be different (since MariaDB is supposed to be a drop-in replacement for MySQL).

@tianon
Copy link
Contributor

tianon commented Aug 27, 2018

I think it's also worth noting docker-library/mysql#471, where that more full-scale templating work has begun (and I think @yosifkit has been working on something similar for PostgreSQL, which has a similar problem).

@danquah
Copy link
Author

danquah commented Aug 28, 2018

Ok, thank you for the clarification. We're currently good with what we have running in the fork, so we'll happily wait for the upstream work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image Request Request for image modification or feature
Development

No branches or pull requests

3 participants