I use MySQL for local test, on each startup MySQL take some time to generate a random SSL certificate.
Is it possible to skip the SSL certificate generation?
Hmm, this is an interesting point -- we don't have a way to skip the mysql_ssl_rsa_setup line easily.
We _do_ check whether the command exists, so you could use that to work around the issue:
FROM mysql:5.7
RUN rm -v "$(which mysql_ssl_rsa_setup)"
Or even hackier:
$ docker run ... -v /dev/null:/usr/bin/mysql_ssl_rsa_setup ... mysql:5.7
Just to be clear, the section of code under discussion is the following:
I seen that, your solution should work well, but maintain a MySQL image only for testing purpose is an extra cost.
Is it possible to add an environment variable like MYSQL_INITDB_SKIP_TZINFO?
Another interesting solution is the variable MYSQL_SERVER_KEY_PEM, so it is possible declare the certificate to use or -optionally- turn off SSL.
Hello,
my +1 to an _env var_ approach (whatever), keeping care to disable any mounted certificate by explicitly passing --ssl=0 too (https://github.com/docker-library/mysql/issues/256), just in case.
In the mean time I'm playing w/ the 1st work around described above.
TIA,
Matteo
Took a different approach over in https://github.com/docker-library/mysql/pull/428 -- basically, if SSL is disabled, we skip the certificate generation (which is exactly what 8.0's initialization scripts seem to do as well).
@tianon
I propose https://github.com/docker-library/mysql/pull/428 is a less than ideal solution.
The use case is: The user has their own certificates/credentials they wan't to supply to mysql AND they don't want to spend time generating new credentials which will never be used. So the user wants to turn off automatic generation of credentials BUT they do not want to turn off SSL.
If the user supplies their own certificates in the appropriate place, MySQL should transparently pick them up and should not create new ones. If that behavior is not working, then we should look at fixing that separately.
With the solution in #428, I'm considering this closed and fixed.
If you wish to not have the image generate SSL certificates, you have two choices:
supply --ssl=0 (this disables SSL in MySQL entirely, which may or may not be what you want)
supply /var/lib/mysql/server-key.pem (which will disable the invocation of mysql_ssl_rsa_setup, thus not generating new keys)