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

Update a few minor bits for consistency and proper failure #134

Merged

Conversation

tianon
Copy link
Member

@tianon tianon commented Jan 20, 2016

  1. whitespace
  2. replace && with ; to ensure set -e Does The Right Thing (see https://www.gnu.org/software/bash/manual/bashref.html#index-set, especially the bit under -e about "part of any command executed in a && or || list except the command following the final && or ||")
  3. add a simple warning for 5.5 + MYSQL_ONETIME_PASSWORD (PASSWORD EXPIRE unsupported)
diff --git a/5.7/docker-entrypoint.sh b/5.6/docker-entrypoint.sh
index 025638a..77feab0 100755
--- a/5.7/docker-entrypoint.sh
+++ b/5.6/docker-entrypoint.sh
@@ -21,7 +21,7 @@ if [ "$1" = 'mysqld' ]; then
        chown -R mysql:mysql "$DATADIR"

        echo 'Initializing database'
-       "$@" --initialize-insecure
+       mysql_install_db --user=mysql --datadir="$DATADIR" --rpm --keep-my-cnf
        echo 'Database initialized'

        "$@" --skip-networking &
diff --git a/5.6/docker-entrypoint.sh b/5.5/docker-entrypoint.sh
index 77feab0..1313cd5 100755
--- a/5.6/docker-entrypoint.sh
+++ b/5.5/docker-entrypoint.sh
@@ -21,10 +21,10 @@ if [ "$1" = 'mysqld' ]; then
        chown -R mysql:mysql "$DATADIR"

        echo 'Initializing database'
-       mysql_install_db --user=mysql --datadir="$DATADIR" --rpm --keep-my-cnf
+       mysql_install_db --user=mysql --datadir="$DATADIR" --rpm --basedir=/usr/local/mysql
        echo 'Database initialized'

-       "$@" --skip-networking &
+       "$@" --skip-networking --basedir=/usr/local/mysql &
        pid="$!"

        mysql=( mysql --protocol=socket -uroot )
@@ -93,9 +93,9 @@ if [ "$1" = 'mysqld' ]; then
        done

        if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then
-           "${mysql[@]}" <<-EOSQL
-               ALTER USER 'root'@'%' PASSWORD EXPIRE;
-           EOSQL
+           echo >&2
+           echo >&2 'Sorry, this version of MySQL does not support "PASSWORD EXPIRE" (required for MYSQL_ONETIME_PASSWORD).'
+           echo >&2
        fi
        if ! kill -s TERM "$pid" || ! wait "$pid"; then
            echo >&2 'MySQL init process failed.'

cc @ltangvald

@tianon tianon force-pushed the consistency-and-proper-failure branch from 57bfe39 to a69b8c6 Compare January 20, 2016 23:27
1. whitespace
2. replace `&&` with `;` to ensure `set -e` Does The Right Thing
3. add a warning for 5.5 + `MYSQL_ONETIME_PASSWORD` (`PASSWORD EXPIRE` unsupported)
@tianon tianon force-pushed the consistency-and-proper-failure branch from a69b8c6 to ed198ce Compare January 21, 2016 00:30
@ltangvald
Copy link
Collaborator

LGTM :)

yosifkit added a commit that referenced this pull request Jan 22, 2016
Update a few minor bits for consistency and proper failure
@yosifkit yosifkit merged commit 2e1fda0 into docker-library:master Jan 22, 2016
@yosifkit yosifkit deleted the consistency-and-proper-failure branch January 22, 2016 18:14
tianon added a commit to infosiftr/stackbrew that referenced this pull request Jan 26, 2016
- `cassandra`: 3.2 (docker-library/cassandra#47)
- `celery`: 3.1.20
- `mariadb`: resync entrypoint with MySQL (MariaDB/mariadb-docker#37, MariaDB/mariadb-docker#34)
- `memcached`: fix SHA1 checking (docker-library/memcached#6)
- `mongo`: 3.0.9, conditional chown, configdb (MariaDB/mariadb-docker#78)
- `mysql`: fix init failure a bit (docker-library/mysql#134)
- `percona`: resync entrypoint with MySQL (docker-library/percona#12)
- `php`: update FPM to use `php-fpm.d` for config (docker-library/php#184)
- `postgres`: remove EOL 9.0 (docker-library/postgres#122)
- `python`: remove EOL 3.2 (docker-library/python#87)
- `rabbitmq`: allow for `--user` to work (docker-library/rabbitmq#60)
- `rails`: 4.2.5.1
- `redmine`: add SCMs (docker-library/redmine#9)
- `rocket.chat`: 0.15.0 (RocketChat/Docker.Official.Image#13)
- `ruby`: silence `root` warning (docker-library/ruby#63)
tianon added a commit to infosiftr/stackbrew that referenced this pull request Jan 26, 2016
- `cassandra`: 3.2 (docker-library/cassandra#47)
- `celery`: 3.1.20
- `mariadb`: resync entrypoint with MySQL (MariaDB/mariadb-docker#37, MariaDB/mariadb-docker#34)
- `memcached`: fix SHA1 checking (docker-library/memcached#6)
- `mongo`: 3.0.9, conditional chown, configdb (MariaDB/mariadb-docker#78)
- `mysql`: fix init failure a bit (docker-library/mysql#134)
- `percona`: resync entrypoint with MySQL (docker-library/percona#12)
- `php`: update FPM to use `php-fpm.d` for config (docker-library/php#184)
- `postgres`: remove EOL 9.0 (docker-library/postgres#122)
- `python`: remove EOL 3.2 (docker-library/python#87)
- `rabbitmq`: allow for `--user` to work (docker-library/rabbitmq#60)
- `rails`: 4.2.5.1
- `redmine`: add SCMs (docker-library/redmine#9)
- `rocket.chat`: 0.15.0 (RocketChat/Docker.Official.Image#13)
- `ruby`: silence `root` warning (docker-library/ruby#63)
tianon added a commit to infosiftr/stackbrew that referenced this pull request Jan 26, 2016
- `cassandra`: 3.2 (docker-library/cassandra#47), run as non-root and allow arbitrary `--user` (docker-library/cassandra#48)
- `celery`: 3.1.20
- `mariadb`: resync entrypoint with MySQL (MariaDB/mariadb-docker#37, MariaDB/mariadb-docker#34)
- `memcached`: fix SHA1 checking (docker-library/memcached#6)
- `mongo`: 3.0.9, conditional chown, configdb (MariaDB/mariadb-docker#78)
- `mysql`: fix init failure a bit (docker-library/mysql#134)
- `percona`: resync entrypoint with MySQL (docker-library/percona#12)
- `php`: update FPM to use `php-fpm.d` for config (docker-library/php#184)
- `postgres`: remove EOL 9.0 (docker-library/postgres#122)
- `python`: remove EOL 3.2 (docker-library/python#87)
- `rabbitmq`: allow for arbitrary `--user` (docker-library/rabbitmq#60)
- `rails`: 4.2.5.1
- `redmine`: add SCMs (docker-library/redmine#9)
- `rocket.chat`: 0.15.0 (RocketChat/Docker.Official.Image#13)
- `ruby`: silence `root` warning (docker-library/ruby#63)
RichardScothern pushed a commit to RichardScothern/official-images that referenced this pull request Jun 14, 2016
- `cassandra`: 3.2 (docker-library/cassandra#47), run as non-root and allow arbitrary `--user` (docker-library/cassandra#48)
- `celery`: 3.1.20
- `mariadb`: resync entrypoint with MySQL (MariaDB/mariadb-docker#37, MariaDB/mariadb-docker#34)
- `memcached`: fix SHA1 checking (docker-library/memcached#6)
- `mongo`: 3.0.9, conditional chown, configdb (MariaDB/mariadb-docker#78)
- `mysql`: fix init failure a bit (docker-library/mysql#134)
- `percona`: resync entrypoint with MySQL (docker-library/percona#12)
- `php`: update FPM to use `php-fpm.d` for config (docker-library/php#184)
- `postgres`: remove EOL 9.0 (docker-library/postgres#122)
- `python`: remove EOL 3.2 (docker-library/python#87)
- `rabbitmq`: allow for arbitrary `--user` (docker-library/rabbitmq#60)
- `rails`: 4.2.5.1
- `redmine`: add SCMs (docker-library/redmine#9)
- `rocket.chat`: 0.15.0 (RocketChat/Docker.Official.Image#13)
- `ruby`: silence `root` warning (docker-library/ruby#63)
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.

3 participants