Skip to content

Add support for "/docker-entrypoint-initdb.d" similar to PostgreSQL's implementation #90

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

Merged

Conversation

tianon
Copy link
Member

@tianon tianon commented Aug 4, 2015

This also cleans up some minor unnecessary bits in docker-entrypoint.sh so that it's more consistent.

Compare to https://github.com/docker-library/postgres/blob/a82c28e1c407ef5ddfc2a6014dac87bcc4955a26/docker-entrypoint.sh#L49-L97

Fixes #24
Closes #87 (implements what was additionally discussed there)

@tianon
Copy link
Member Author

tianon commented Aug 4, 2015

cc @ltangvald @yosifkit

for i in $(seq 30 -1 0); do
[ -S "$SOCKET" ] && break
mysqld --user=mysql --datadir="$DATADIR" --skip-networking --basedir=/usr/local/mysql &
pid="$!"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By using $! instead of parsing the mysqld config, we can guarantee that the process is a child of our shell and thus we can wait on it during shutdown (see below) instead of looping while we wait for it to die.

@tianon tianon force-pushed the docker-entrypoint-initdb.d branch from 55fa7a5 to 14f1655 Compare August 4, 2015 23:10
@yosifkit
Copy link
Member

yosifkit commented Aug 5, 2015

LGTM

yosifkit added a commit that referenced this pull request Aug 6, 2015
Add support for "/docker-entrypoint-initdb.d" similar to PostgreSQL's implementation
@yosifkit yosifkit merged commit a5fe2ca into docker-library:master Aug 6, 2015
@yosifkit yosifkit deleted the docker-entrypoint-initdb.d branch August 6, 2015 23:45
@funkyfuture
Copy link

Are there docs on this functionality?

@yosifkit
Copy link
Member

yosifkit commented Aug 7, 2015

Looks like we forgot to do that. it should be fairly similar to the one for postgres: https://hub.docker.com/_/postgres/#how-to-extend-this-image

@ltangvald
Copy link
Collaborator

Very nice! The upcoming http://dev.mysql.com/doc/refman/5.7/en/shutdown.html might help clean up the entrypoint script further.

@thaJeztah
Copy link

Thanks @ltangvald! And thanks @tianon I think this could make many people happy

@funkyfuture
Copy link

here's one: 💃

@tianon
Copy link
Member Author

tianon commented Aug 11, 2015

@ltangvald oh interesting -- I'll bet we could just use mysqladmin directly right now, couldn't we?

@ltangvald
Copy link
Collaborator

No, unfortunately I got a bit too excited about it :)
mysqladmin shutdown will send a shutdown signal, but won't wait for a complete server shutdown.
So the SHUTDOWN statement won't be very useful as it is now. We'd need to put everything into a single init-file with the syntax constraints that imply.

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

Successfully merging this pull request may close these issues.

5 participants