From ee989d0666458d08dd79c55f7abb62be29a9cb3d Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 12 Dec 2016 03:15:14 -0800 Subject: [PATCH 001/285] Update to 5.5.54 --- 5.5/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index 3eb024543..a91c46282 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf RUN apt-get update && apt-get install -y libaio1 pwgen && rm -rf /var/lib/apt/lists/* ENV MYSQL_MAJOR 5.5 -ENV MYSQL_VERSION 5.5.53 +ENV MYSQL_VERSION 5.5.54 RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux2.6-x86_64.tar.gz" -O mysql.tar.gz \ From fd3bdabe513643b62fc379f365b2b5dd10886311 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 12 Dec 2016 09:15:17 -0800 Subject: [PATCH 002/285] Update to 5.6.35-1debian8 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 392a9cbae..f9523a562 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y perl pwgen --no-install-recommends && r RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.34-1debian8 +ENV MYSQL_VERSION 5.6.35-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From c207cc19a272a6bfe1916c964ed8df47f18479e7 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 12 Dec 2016 09:15:17 -0800 Subject: [PATCH 003/285] Update to 5.7.17-1debian8 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index f15db9774..f883a7672 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y perl pwgen --no-install-recommends && r RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.16-1debian8 +ENV MYSQL_VERSION 5.7.17-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 56e06bbed26b0e1893493c0dfd168d843c87e766 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Fri, 30 Dec 2016 16:54:48 -0800 Subject: [PATCH 004/285] Add ability to change host value for root user to secure container --- 5.5/docker-entrypoint.sh | 20 +++++++++++++++++--- 5.6/docker-entrypoint.sh | 20 +++++++++++++++++--- 5.7/docker-entrypoint.sh | 20 +++++++++++++++++--- 8.0/docker-entrypoint.sh | 20 +++++++++++++++++--- 4 files changed, 68 insertions(+), 12 deletions(-) diff --git a/5.5/docker-entrypoint.sh b/5.5/docker-entrypoint.sh index 0c7ac6baf..429560ebf 100755 --- a/5.5/docker-entrypoint.sh +++ b/5.5/docker-entrypoint.sh @@ -113,14 +113,28 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi + + rootCreate= + # default root to listen for connections from anywhere + file_env 'MYSQL_ROOT_HOST' '%' + if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then + # no, we don't care if read finds a terminating character in this heredoc + # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 + read -r -d '' rootCreate <<-EOSQL || true + CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ; + EOSQL + fi + "${mysql[@]}" <<-EOSQL -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - DELETE FROM mysql.user ; - CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ; + DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; + SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; + GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; + ${rootCreate} DROP DATABASE IF EXISTS test ; FLUSH PRIVILEGES ; EOSQL diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index e81438b1c..0e7bfcedc 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -113,14 +113,28 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi + + rootCreate= + # default root to listen for connections from anywhere + file_env 'MYSQL_ROOT_HOST' '%' + if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then + # no, we don't care if read finds a terminating character in this heredoc + # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 + read -r -d '' rootCreate <<-EOSQL || true + CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ; + EOSQL + fi + "${mysql[@]}" <<-EOSQL -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - DELETE FROM mysql.user ; - CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ; + DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; + SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; + GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; + ${rootCreate} DROP DATABASE IF EXISTS test ; FLUSH PRIVILEGES ; EOSQL diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index b944177da..eb01ec1ad 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -113,14 +113,28 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi + + rootCreate= + # default root to listen for connections from anywhere + file_env 'MYSQL_ROOT_HOST' '%' + if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then + # no, we don't care if read finds a terminating character in this heredoc + # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 + read -r -d '' rootCreate <<-EOSQL || true + CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ; + EOSQL + fi + "${mysql[@]}" <<-EOSQL -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - DELETE FROM mysql.user ; - CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ; + DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; + SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; + GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; + ${rootCreate} DROP DATABASE IF EXISTS test ; FLUSH PRIVILEGES ; EOSQL diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index b944177da..eb01ec1ad 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -113,14 +113,28 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi + + rootCreate= + # default root to listen for connections from anywhere + file_env 'MYSQL_ROOT_HOST' '%' + if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then + # no, we don't care if read finds a terminating character in this heredoc + # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 + read -r -d '' rootCreate <<-EOSQL || true + CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ; + EOSQL + fi + "${mysql[@]}" <<-EOSQL -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - DELETE FROM mysql.user ; - CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ; + DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; + SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; + GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; + ${rootCreate} DROP DATABASE IF EXISTS test ; FLUSH PRIVILEGES ; EOSQL From b4b7c8eea0690d0406a5ffc2d3404c8c42457a2d Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 10 Jan 2017 15:26:14 -0800 Subject: [PATCH 005/285] Use "/etc/apt/trusted.gpg.d" instead of "apt-key adv" > Note: Instead of using this command a keyring should be placed > directly in the /etc/apt/trusted.gpg.d/ directory with a > descriptive name and either "gpg" or "asc" as file extension. https://manpages.debian.org/cgi-bin/man.cgi?query=apt-key&manpath=Debian+testing+stretch --- 5.6/Dockerfile | 8 +++++++- 5.7/Dockerfile | 8 +++++++- 8.0/Dockerfile | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index f9523a562..34cb0e17b 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -26,8 +26,14 @@ RUN mkdir /docker-entrypoint-initdb.d # Data::Dumper RUN apt-get update && apt-get install -y perl pwgen --no-install-recommends && rm -rf /var/lib/apt/lists/* +RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported -RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 + key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + rm -r "$GNUPGHOME"; \ + apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 ENV MYSQL_VERSION 5.6.35-1debian8 diff --git a/5.7/Dockerfile b/5.7/Dockerfile index f883a7672..94fd1e0de 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -26,8 +26,14 @@ RUN mkdir /docker-entrypoint-initdb.d # Data::Dumper RUN apt-get update && apt-get install -y perl pwgen --no-install-recommends && rm -rf /var/lib/apt/lists/* +RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported -RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 + key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + rm -r "$GNUPGHOME"; \ + apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 ENV MYSQL_VERSION 5.7.17-1debian8 diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 28f1fc94c..6bf14295d 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -26,8 +26,14 @@ RUN mkdir /docker-entrypoint-initdb.d # Data::Dumper RUN apt-get update && apt-get install -y perl pwgen --no-install-recommends && rm -rf /var/lib/apt/lists/* +RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported -RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 + key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + rm -r "$GNUPGHOME"; \ + apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 ENV MYSQL_VERSION 8.0.0-dmr-1debian8 From eeb0c33dfcad3db46a0dfb24c352d2a1601c7667 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 26 Jan 2017 11:57:56 -0800 Subject: [PATCH 006/285] Add "openssl" and invoke "mysql_ssl_rsa_setup" at runtime so that automatic SSL works the same as the MySQL packages --- 5.7/Dockerfile | 8 +++++++- 5.7/docker-entrypoint.sh | 7 +++++++ 8.0/Dockerfile | 8 +++++++- 8.0/docker-entrypoint.sh | 7 +++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 94fd1e0de..2f19033b8 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -19,12 +19,18 @@ RUN set -x \ RUN mkdir /docker-entrypoint-initdb.d +RUN apt-get update && apt-get install -y --no-install-recommends \ +# for MYSQL_RANDOM_ROOT_PASSWORD + pwgen \ +# for mysql_ssl_rsa_setup + openssl \ # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename # File::Copy # Sys::Hostname # Data::Dumper -RUN apt-get update && apt-get install -y perl pwgen --no-install-recommends && rm -rf /var/lib/apt/lists/* + perl \ + && rm -rf /var/lib/apt/lists/* RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index eb01ec1ad..ea515ceca 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -87,6 +87,13 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then "$@" --initialize-insecure echo 'Database initialized' + if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then + # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 + echo 'Initializing certificates' + mysql_ssl_rsa_setup --datadir="$DATADIR" + echo 'Certificates initialized' + fi + "$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock & pid="$!" diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 6bf14295d..2cba5af53 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -19,12 +19,18 @@ RUN set -x \ RUN mkdir /docker-entrypoint-initdb.d +RUN apt-get update && apt-get install -y --no-install-recommends \ +# for MYSQL_RANDOM_ROOT_PASSWORD + pwgen \ +# for mysql_ssl_rsa_setup + openssl \ # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename # File::Copy # Sys::Hostname # Data::Dumper -RUN apt-get update && apt-get install -y perl pwgen --no-install-recommends && rm -rf /var/lib/apt/lists/* + perl \ + && rm -rf /var/lib/apt/lists/* RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index eb01ec1ad..ea515ceca 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -87,6 +87,13 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then "$@" --initialize-insecure echo 'Database initialized' + if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then + # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 + echo 'Initializing certificates' + mysql_ssl_rsa_setup --datadir="$DATADIR" + echo 'Certificates initialized' + fi + "$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock & pid="$!" From 6683a07872718dcfffcf50e4adf075c05804d5bc Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 16 Feb 2017 09:56:36 +0100 Subject: [PATCH 007/285] Fetch client --socket value from config instead of hardcoding it Hardcoding the socket path for the init run broke initdb.d/ scripts that expected a different location (because 5.5 has a different default or the user changed the config). Added a function for fetching it with mysqld --verbose --help as we do for datadir, and use that for the initialization runs of the server and client. --- 5.5/docker-entrypoint.sh | 10 ++++++++-- 5.6/docker-entrypoint.sh | 10 ++++++++-- 5.7/docker-entrypoint.sh | 10 ++++++++-- 8.0/docker-entrypoint.sh | 10 ++++++++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/5.5/docker-entrypoint.sh b/5.5/docker-entrypoint.sh index 429560ebf..32aab0742 100755 --- a/5.5/docker-entrypoint.sh +++ b/5.5/docker-entrypoint.sh @@ -58,6 +58,11 @@ _datadir() { "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "datadir" { print $2; exit }' } +# For use with the client if user passes the --socket argument +_socket() { + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "socket" { print $2; exit }' +} + # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then _check_config "$@" @@ -87,10 +92,11 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then mysql_install_db --datadir="$DATADIR" --rpm --basedir=/usr/local/mysql echo 'Database initialized' - "$@" --skip-networking --basedir=/usr/local/mysql --socket=/var/run/mysqld/mysqld.sock & + SOCKET="$(_socket "$@")" + "$@" --skip-networking --basedir=/usr/local/mysql --socket="${SOCKET}" & pid="$!" - mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock) + mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) for i in {30..0}; do if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 0e7bfcedc..c923d8b62 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -58,6 +58,11 @@ _datadir() { "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "datadir" { print $2; exit }' } +# For use with the client if user passes the --socket argument +_socket() { + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "socket" { print $2; exit }' +} + # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then _check_config "$@" @@ -87,10 +92,11 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf echo 'Database initialized' - "$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock & + SOCKET="$(_socket "$@")" + "$@" --skip-networking --socket="${SOCKET}" & pid="$!" - mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock) + mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) for i in {30..0}; do if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index ea515ceca..5296f33fd 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -58,6 +58,11 @@ _datadir() { "$@" --verbose --help 2>/dev/null | awk '$1 == "datadir" { print $2; exit }' } +# For use with the client if user passes the --socket argument +_socket() { + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "socket" { print $2; exit }' +} + # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then _check_config "$@" @@ -94,10 +99,11 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then echo 'Certificates initialized' fi - "$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock & + SOCKET="$(_socket "$@")" + "$@" --skip-networking --socket="${SOCKET}" & pid="$!" - mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock) + mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) for i in {30..0}; do if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index ea515ceca..5296f33fd 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -58,6 +58,11 @@ _datadir() { "$@" --verbose --help 2>/dev/null | awk '$1 == "datadir" { print $2; exit }' } +# For use with the client if user passes the --socket argument +_socket() { + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "socket" { print $2; exit }' +} + # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then _check_config "$@" @@ -94,10 +99,11 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then echo 'Certificates initialized' fi - "$@" --skip-networking --socket=/var/run/mysqld/mysqld.sock & + SOCKET="$(_socket "$@")" + "$@" --skip-networking --socket="${SOCKET}" & pid="$!" - mysql=( mysql --protocol=socket -uroot -hlocalhost --socket=/var/run/mysqld/mysqld.sock) + mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) for i in {30..0}; do if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then From eb8679bfb996f9f3d6e64c24fddd0fa7624e65b6 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 16 Feb 2017 10:03:39 +0100 Subject: [PATCH 008/285] Removed unneeded option from --verbose --help run (5.7+) --- 5.7/docker-entrypoint.sh | 2 +- 8.0/docker-entrypoint.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 5296f33fd..d907a4ae5 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -60,7 +60,7 @@ _datadir() { # For use with the client if user passes the --socket argument _socket() { - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "socket" { print $2; exit }' + "$@" --verbose --help 2>/dev/null | awk '$1 == "socket" { print $2; exit }' } # allow the container to be started with `--user` diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 5296f33fd..d907a4ae5 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -60,7 +60,7 @@ _datadir() { # For use with the client if user passes the --socket argument _socket() { - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "socket" { print $2; exit }' + "$@" --verbose --help 2>/dev/null | awk '$1 == "socket" { print $2; exit }' } # allow the container to be started with `--user` From e65276405983596f63b686f1b117571d1aa87412 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 27 Feb 2017 16:14:04 -0800 Subject: [PATCH 009/285] Add "travis_retry" to our build to reduce transitory failures Documentation is at https://docs.travis-ci.com/user/common-build-problems/#travis_retry See https://github.com/docker-library/memcached/pull/14 for the test PR for this pattern. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 70b4bee93..e75ebda4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ before_script: - image="mysql:$VERSION" script: - - docker build -t "$image" . + - travis_retry docker build -t "$image" . - ~/official-images/test/run.sh "$image" after_script: From f42fa91856b557940a4ddd86d70cc2518cab818b Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 1 Mar 2017 08:12:40 +0100 Subject: [PATCH 010/285] Combine _datadir and _socket functions into general _get_config The new function takes as input the config value to fetch --- 5.5/docker-entrypoint.sh | 19 +++++++++---------- 5.6/docker-entrypoint.sh | 19 +++++++++---------- 5.7/docker-entrypoint.sh | 19 +++++++++---------- 8.0/docker-entrypoint.sh | 19 +++++++++---------- 4 files changed, 36 insertions(+), 40 deletions(-) diff --git a/5.5/docker-entrypoint.sh b/5.5/docker-entrypoint.sh index 32aab0742..e85315f60 100755 --- a/5.5/docker-entrypoint.sh +++ b/5.5/docker-entrypoint.sh @@ -54,19 +54,18 @@ _check_config() { fi } -_datadir() { - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "datadir" { print $2; exit }' -} - -# For use with the client if user passes the --socket argument -_socket() { - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "socket" { print $2; exit }' +# Fetch value from server config +# We use mysqld --verbose --help instead of my_print_defaults because the +# latter only show values present in config files, and not server defaults +_get_config() { + local conf="$1"; shift + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }' } # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then _check_config "$@" - DATADIR="$(_datadir "$@")" + DATADIR="$(_get_config 'datadir' "$@")" mkdir -p "$DATADIR" chown -R mysql:mysql "$DATADIR" exec gosu mysql "$BASH_SOURCE" "$@" @@ -76,7 +75,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then # still need to check config, container may have started with --user _check_config "$@" # Get config - DATADIR="$(_datadir "$@")" + DATADIR="$(_get_config 'datadir' "$@")" if [ ! -d "$DATADIR/mysql" ]; then file_env 'MYSQL_ROOT_PASSWORD' @@ -92,7 +91,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then mysql_install_db --datadir="$DATADIR" --rpm --basedir=/usr/local/mysql echo 'Database initialized' - SOCKET="$(_socket "$@")" + SOCKET="$(_get_config 'socket' "$@")" "$@" --skip-networking --basedir=/usr/local/mysql --socket="${SOCKET}" & pid="$!" diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index c923d8b62..912875dca 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -54,19 +54,18 @@ _check_config() { fi } -_datadir() { - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "datadir" { print $2; exit }' -} - -# For use with the client if user passes the --socket argument -_socket() { - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "socket" { print $2; exit }' +# Fetch value from server config +# We use mysqld --verbose --help instead of my_print_defaults because the +# latter only show values present in config files, and not server defaults +_get_config() { + local conf="$1"; shift + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }' } # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then _check_config "$@" - DATADIR="$(_datadir "$@")" + DATADIR="$(_get_config 'datadir' "$@")" mkdir -p "$DATADIR" chown -R mysql:mysql "$DATADIR" exec gosu mysql "$BASH_SOURCE" "$@" @@ -76,7 +75,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then # still need to check config, container may have started with --user _check_config "$@" # Get config - DATADIR="$(_datadir "$@")" + DATADIR="$(_get_config 'datadir' "$@")" if [ ! -d "$DATADIR/mysql" ]; then file_env 'MYSQL_ROOT_PASSWORD' @@ -92,7 +91,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf echo 'Database initialized' - SOCKET="$(_socket "$@")" + SOCKET="$(_get_config 'socket' "$@")" "$@" --skip-networking --socket="${SOCKET}" & pid="$!" diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index d907a4ae5..a6ab80c5f 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -54,19 +54,18 @@ _check_config() { fi } -_datadir() { - "$@" --verbose --help 2>/dev/null | awk '$1 == "datadir" { print $2; exit }' -} - -# For use with the client if user passes the --socket argument -_socket() { - "$@" --verbose --help 2>/dev/null | awk '$1 == "socket" { print $2; exit }' +# Fetch value from server config +# We use mysqld --verbose --help instead of my_print_defaults because the +# latter only show values present in config files, and not server defaults +_get_config() { + local conf="$1"; shift + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }' } # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then _check_config "$@" - DATADIR="$(_datadir "$@")" + DATADIR="$(_get_config 'datadir' "$@")" mkdir -p "$DATADIR" chown -R mysql:mysql "$DATADIR" exec gosu mysql "$BASH_SOURCE" "$@" @@ -76,7 +75,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then # still need to check config, container may have started with --user _check_config "$@" # Get config - DATADIR="$(_datadir "$@")" + DATADIR="$(_get_config 'datadir' "$@")" if [ ! -d "$DATADIR/mysql" ]; then file_env 'MYSQL_ROOT_PASSWORD' @@ -99,7 +98,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then echo 'Certificates initialized' fi - SOCKET="$(_socket "$@")" + SOCKET="$(_get_config 'socket' "$@")" "$@" --skip-networking --socket="${SOCKET}" & pid="$!" diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index d907a4ae5..a6ab80c5f 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -54,19 +54,18 @@ _check_config() { fi } -_datadir() { - "$@" --verbose --help 2>/dev/null | awk '$1 == "datadir" { print $2; exit }' -} - -# For use with the client if user passes the --socket argument -_socket() { - "$@" --verbose --help 2>/dev/null | awk '$1 == "socket" { print $2; exit }' +# Fetch value from server config +# We use mysqld --verbose --help instead of my_print_defaults because the +# latter only show values present in config files, and not server defaults +_get_config() { + local conf="$1"; shift + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }' } # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then _check_config "$@" - DATADIR="$(_datadir "$@")" + DATADIR="$(_get_config 'datadir' "$@")" mkdir -p "$DATADIR" chown -R mysql:mysql "$DATADIR" exec gosu mysql "$BASH_SOURCE" "$@" @@ -76,7 +75,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then # still need to check config, container may have started with --user _check_config "$@" # Get config - DATADIR="$(_datadir "$@")" + DATADIR="$(_get_config 'datadir' "$@")" if [ ! -d "$DATADIR/mysql" ]; then file_env 'MYSQL_ROOT_PASSWORD' @@ -99,7 +98,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then echo 'Certificates initialized' fi - SOCKET="$(_socket "$@")" + SOCKET="$(_get_config 'socket' "$@")" "$@" --skip-networking --socket="${SOCKET}" & pid="$!" From 2297b60ac72c157ad8e2435ff971e6a49bc47f47 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 10 Apr 2017 03:15:22 -0700 Subject: [PATCH 011/285] Update to 5.5.55 --- 5.5/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index a91c46282..8efa0631f 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf RUN apt-get update && apt-get install -y libaio1 pwgen && rm -rf /var/lib/apt/lists/* ENV MYSQL_MAJOR 5.5 -ENV MYSQL_VERSION 5.5.54 +ENV MYSQL_VERSION 5.5.55 RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux2.6-x86_64.tar.gz" -O mysql.tar.gz \ From 2bbab7b691b582e2df99dbd16525608adbff016e Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 10 Apr 2017 21:15:26 -0700 Subject: [PATCH 012/285] Update to 5.6.36-1debian8 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 34cb0e17b..128826580 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -36,7 +36,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.35-1debian8 +ENV MYSQL_VERSION 5.6.36-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 7a850980c4b0d5fb5553986d280ebfb43230a6bb Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 10 Apr 2017 21:15:26 -0700 Subject: [PATCH 013/285] Update to 8.0.1-dmr-1debian8 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 2cba5af53..b7a601a42 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -42,7 +42,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.0-dmr-1debian8 +ENV MYSQL_VERSION 8.0.1-dmr-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 6b1dc54320b03b83a89068f49cc796fea0ff6bb4 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 10 Apr 2017 21:15:26 -0700 Subject: [PATCH 014/285] Update to 5.7.18-1debian8 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 2f19033b8..b2cb13bcf 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -42,7 +42,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.17-1debian8 +ENV MYSQL_VERSION 5.7.18-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From ba70c92ea04c715d293455ffa9fb20b71a794f8e Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Tue, 11 Apr 2017 07:46:05 +0200 Subject: [PATCH 015/285] Use new -core packages for 8.0.1+ The packages mysql-community-client-core and mysql-community-server-core contain only the binaries needed by the client and server, with no configuration, services or debug binaries, making them significantly smaller in size. * Install -core packages instead of full mysql-server Images that build on this and install further packages that depend on MySQL may lose the size benefit if the dep is on "mysql-server", but should otherwise work as before. * Add all config files, since core packages do not include any. Included the config files in git instead of generating them in the build script, to make it a bit easier to see exactly what the default config of the image is. --- 8.0/Dockerfile | 11 +++-------- 8.0/mysql/conf.d/docker.cnf | 3 +++ 8.0/mysql/my.cnf | 17 +++++++++++++++++ 8.0/mysql/mysql.conf.d/mysqld.cnf | 28 ++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 8.0/mysql/conf.d/docker.cnf create mode 100644 8.0/mysql/my.cnf create mode 100644 8.0/mysql/mysql.conf.d/mysqld.cnf diff --git a/8.0/Dockerfile b/8.0/Dockerfile index b7a601a42..b88198c21 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -1,5 +1,4 @@ FROM debian:jessie - # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql @@ -54,19 +53,15 @@ RUN { \ echo mysql-community-server mysql-community-server/re-root-pass password ''; \ echo mysql-community-server mysql-community-server/remove-test-db select false; \ } | debconf-set-selections \ - && apt-get update && apt-get install -y mysql-server="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \ + && apt-get update && apt-get install -y mysql-community-client-core="${MYSQL_VERSION}" mysql-community-server-core="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime && chmod 777 /var/run/mysqld -# comment out a few problematic configuration values -# don't reverse lookup hostnames, they are usually another container -RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/mysql.conf.d/mysqld.cnf \ - && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf - VOLUME /var/lib/mysql - +# Config files +COPY mysql/ /etc/mysql/ COPY docker-entrypoint.sh /usr/local/bin/ RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/8.0/mysql/conf.d/docker.cnf b/8.0/mysql/conf.d/docker.cnf new file mode 100644 index 000000000..4f1829d66 --- /dev/null +++ b/8.0/mysql/conf.d/docker.cnf @@ -0,0 +1,3 @@ +[mysqld] +skip-host-cache +skip-name-resolve diff --git a/8.0/mysql/my.cnf b/8.0/mysql/my.cnf new file mode 100644 index 000000000..15d337cfd --- /dev/null +++ b/8.0/mysql/my.cnf @@ -0,0 +1,17 @@ +# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +!includedir /etc/mysql/conf.d/ +!includedir /etc/mysql/mysql.conf.d/ diff --git a/8.0/mysql/mysql.conf.d/mysqld.cnf b/8.0/mysql/mysql.conf.d/mysqld.cnf new file mode 100644 index 000000000..7b29b793e --- /dev/null +++ b/8.0/mysql/mysql.conf.d/mysqld.cnf @@ -0,0 +1,28 @@ +# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# +# The MySQL Server configuration file. +# +# For explanations see +# http://dev.mysql.com/doc/mysql/en/server-system-variables.html + +[mysqld] +pid-file = /var/run/mysqld/mysqld.pid +socket = /var/run/mysqld/mysqld.sock +datadir = /var/lib/mysql +secure-file-priv= NULL +# Disabling symbolic-links is recommended to prevent assorted security risks +symbolic-links=0 From dc60c4b80f3eb5b7ef8b9ae09f16f6fab7a2fbf5 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 27 Apr 2017 08:15:34 +0200 Subject: [PATCH 016/285] Simplified configuration structure Default server config is now in config/my.cnf, which only includes conf.d --- 8.0/Dockerfile | 2 +- 8.0/{mysql => config}/conf.d/docker.cnf | 0 .../mysql.conf.d/mysqld.cnf => config/my.cnf} | 5 ++++- 8.0/mysql/my.cnf | 17 ----------------- 4 files changed, 5 insertions(+), 19 deletions(-) rename 8.0/{mysql => config}/conf.d/docker.cnf (100%) rename 8.0/{mysql/mysql.conf.d/mysqld.cnf => config/my.cnf} (88%) delete mode 100644 8.0/mysql/my.cnf diff --git a/8.0/Dockerfile b/8.0/Dockerfile index b88198c21..d60f039d6 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -61,7 +61,7 @@ RUN { \ VOLUME /var/lib/mysql # Config files -COPY mysql/ /etc/mysql/ +COPY config/ /etc/mysql/ COPY docker-entrypoint.sh /usr/local/bin/ RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/8.0/mysql/conf.d/docker.cnf b/8.0/config/conf.d/docker.cnf similarity index 100% rename from 8.0/mysql/conf.d/docker.cnf rename to 8.0/config/conf.d/docker.cnf diff --git a/8.0/mysql/mysql.conf.d/mysqld.cnf b/8.0/config/my.cnf similarity index 88% rename from 8.0/mysql/mysql.conf.d/mysqld.cnf rename to 8.0/config/my.cnf index 7b29b793e..e9f2eda42 100644 --- a/8.0/mysql/mysql.conf.d/mysqld.cnf +++ b/8.0/config/my.cnf @@ -1,4 +1,4 @@ -# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,3 +26,6 @@ datadir = /var/lib/mysql secure-file-priv= NULL # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 + +# Custom config should go here +!includedir /etc/mysql/conf.d/ diff --git a/8.0/mysql/my.cnf b/8.0/mysql/my.cnf deleted file mode 100644 index 15d337cfd..000000000 --- a/8.0/mysql/my.cnf +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -!includedir /etc/mysql/conf.d/ -!includedir /etc/mysql/mysql.conf.d/ From e8a0ed55678d27039905c50f8327f3a367e92498 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 4 May 2017 10:32:05 -0700 Subject: [PATCH 017/285] Update to 5.5.56 (accounting for the tarball rename) --- 5.5/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index 8efa0631f..0a46d5d60 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -30,11 +30,11 @@ RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf RUN apt-get update && apt-get install -y libaio1 pwgen && rm -rf /var/lib/apt/lists/* ENV MYSQL_MAJOR 5.5 -ENV MYSQL_VERSION 5.5.55 +ENV MYSQL_VERSION 5.5.56 RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux2.6-x86_64.tar.gz" -O mysql.tar.gz \ - && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux2.6-x86_64.tar.gz.asc" -O mysql.tar.gz.asc \ + && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.5-x86_64.tar.gz" -O mysql.tar.gz \ + && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.5-x86_64.tar.gz.asc" -O mysql.tar.gz.asc \ && apt-get purge -y --auto-remove ca-certificates wget \ && export GNUPGHOME="$(mktemp -d)" \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported From 08b08d88066bc27f82212631e1d3415b61097afe Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 17 Jul 2017 12:07:59 -0700 Subject: [PATCH 018/285] Update to 5.5.57 (accounting for the glibc2.5 -> glibc2.12 adjustment) --- 5.5/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index 0a46d5d60..6fa0445db 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -30,11 +30,11 @@ RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf RUN apt-get update && apt-get install -y libaio1 pwgen && rm -rf /var/lib/apt/lists/* ENV MYSQL_MAJOR 5.5 -ENV MYSQL_VERSION 5.5.56 +ENV MYSQL_VERSION 5.5.57 RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.5-x86_64.tar.gz" -O mysql.tar.gz \ - && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.5-x86_64.tar.gz.asc" -O mysql.tar.gz.asc \ + && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.12-x86_64.tar.gz" -O mysql.tar.gz \ + && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.12-x86_64.tar.gz.asc" -O mysql.tar.gz.asc \ && apt-get purge -y --auto-remove ca-certificates wget \ && export GNUPGHOME="$(mktemp -d)" \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported From 7ee927986b8c0cbfa6cdbb073a0e662bdb62c18a Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 17 Jul 2017 22:15:48 +0000 Subject: [PATCH 019/285] Update to 5.6.37-1debian8 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 128826580..d755d3aac 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -36,7 +36,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.36-1debian8 +ENV MYSQL_VERSION 5.6.37-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 0590e4efd2b31ec794383f084d419dea9bc752c4 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 17 Jul 2017 22:15:48 +0000 Subject: [PATCH 020/285] Update to 5.7.19-1debian8 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index b2cb13bcf..bb2453431 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -42,7 +42,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.18-1debian8 +ENV MYSQL_VERSION 5.7.19-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From e207dbbdfd5c95e4b51bdc2dae62c5f72a1dd908 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 17 Jul 2017 22:15:48 +0000 Subject: [PATCH 021/285] Update to 8.0.2-dmr-1debian8 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index d60f039d6..0fec96e17 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -41,7 +41,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.1-dmr-1debian8 +ENV MYSQL_VERSION 8.0.2-dmr-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 86431f073b3d2f963d21e33cb8943f0bdcdf143d Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Thu, 21 Sep 2017 16:15:05 +0000 Subject: [PATCH 022/285] Update to 8.0.3-rc-1debian8 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 0fec96e17..e8a58a31e 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -41,7 +41,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.2-dmr-1debian8 +ENV MYSQL_VERSION 8.0.3-rc-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 41cfbdd89323a1230342038757b5b8f7f2f36b74 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 16 Oct 2017 10:15:04 +0000 Subject: [PATCH 023/285] Update to 5.5.58 --- 5.5/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index 6fa0445db..efe0df38b 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf RUN apt-get update && apt-get install -y libaio1 pwgen && rm -rf /var/lib/apt/lists/* ENV MYSQL_MAJOR 5.5 -ENV MYSQL_VERSION 5.5.57 +ENV MYSQL_VERSION 5.5.58 RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.12-x86_64.tar.gz" -O mysql.tar.gz \ From 429047ac5e28d59d40a2ac84a189c9d25310f060 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 16 Oct 2017 16:15:05 +0000 Subject: [PATCH 024/285] Update to 5.7.20-1debian8 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index bb2453431..7da0d35c2 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -42,7 +42,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.19-1debian8 +ENV MYSQL_VERSION 5.7.20-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From d8e7c8b6c0ba854fd5ea8257b79a2b3377f668ae Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 16 Oct 2017 16:15:05 +0000 Subject: [PATCH 025/285] Update to 5.6.38-1debian8 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index d755d3aac..c4eb927ba 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -36,7 +36,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.37-1debian8 +ENV MYSQL_VERSION 5.6.38-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 883703dfb30d9c197e0059a669c4bb64d55f6e0d Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Mon, 23 Oct 2017 15:47:01 -0700 Subject: [PATCH 026/285] MySQL system provided cnf's keep moving, ensure that any system provided cnf does not set bind-address or log --- 5.6/Dockerfile | 7 ++++--- 5.7/Dockerfile | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index c4eb927ba..1456b6c8a 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -52,11 +52,12 @@ RUN { \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 777 /var/run/mysqld - + && chmod 777 /var/run/mysqld \ # comment out a few problematic configuration values + && find /etc/mysql/ -name '*.cnf' -print0 \ + | xargs -0 grep -lZE '^(bind-address|log)' \ + | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \ # don't reverse lookup hostnames, they are usually another container -RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/my.cnf \ && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf VOLUME /var/lib/mysql diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 7da0d35c2..ebaf0aae5 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -58,11 +58,12 @@ RUN { \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 777 /var/run/mysqld - + && chmod 777 /var/run/mysqld \ # comment out a few problematic configuration values + && find /etc/mysql/ -name '*.cnf' -print0 \ + | xargs -0 grep -lZE '^(bind-address|log)' \ + | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \ # don't reverse lookup hostnames, they are usually another container -RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/mysql/mysql.conf.d/mysqld.cnf \ && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf VOLUME /var/lib/mysql From 6c414e7f38c2079c7193beae5dc7c34ee46cd6e7 Mon Sep 17 00:00:00 2001 From: Dmitry Ershov Date: Mon, 4 Dec 2017 02:43:52 +0500 Subject: [PATCH 027/285] Prevent mysql.session account deletion instead of mysqlxsys --- 5.7/docker-entrypoint.sh | 2 +- 8.0/docker-entrypoint.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index a6ab80c5f..08a8256dd 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -143,7 +143,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; + DELETE FROM mysql.user WHERE user NOT IN ('mysql.session', 'mysql.sys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; ${rootCreate} diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index a6ab80c5f..08a8256dd 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -143,7 +143,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; + DELETE FROM mysql.user WHERE user NOT IN ('mysql.session', 'mysql.sys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; ${rootCreate} From 36f2030de879bea73e808183302d27c3b670ce7a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 21 Dec 2017 13:34:50 -0800 Subject: [PATCH 028/285] Pass extra mysqld flags to mysql_install_db --- 5.5/docker-entrypoint.sh | 3 ++- 5.6/docker-entrypoint.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/5.5/docker-entrypoint.sh b/5.5/docker-entrypoint.sh index e85315f60..122ff2ddd 100755 --- a/5.5/docker-entrypoint.sh +++ b/5.5/docker-entrypoint.sh @@ -88,7 +88,8 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then mkdir -p "$DATADIR" echo 'Initializing database' - mysql_install_db --datadir="$DATADIR" --rpm --basedir=/usr/local/mysql + # "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here) + mysql_install_db --datadir="$DATADIR" --rpm --basedir=/usr/local/mysql "${@:2}" echo 'Database initialized' SOCKET="$(_get_config 'socket' "$@")" diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 912875dca..e654ea63e 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -88,7 +88,8 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then mkdir -p "$DATADIR" echo 'Initializing database' - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf + # "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here) + mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" echo 'Database initialized' SOCKET="$(_get_config 'socket' "$@")" From 90c4f75a642d6685f4fe4d8fc585e88339ed2cb1 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 15 Jan 2018 11:15:05 +0000 Subject: [PATCH 029/285] Update to 5.5.59 --- 5.5/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index efe0df38b..eca336a2d 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf RUN apt-get update && apt-get install -y libaio1 pwgen && rm -rf /var/lib/apt/lists/* ENV MYSQL_MAJOR 5.5 -ENV MYSQL_VERSION 5.5.58 +ENV MYSQL_VERSION 5.5.59 RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.12-x86_64.tar.gz" -O mysql.tar.gz \ From 607b2a65aa76adf495730b9f7e6f28f146a9f95f Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 15 Jan 2018 09:15:05 -0800 Subject: [PATCH 030/285] Update to 5.7.21-1debian8 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index ebaf0aae5..5813c376b 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -42,7 +42,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.20-1debian8 +ENV MYSQL_VERSION 5.7.21-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From b6156cf8c6a1e9702440489bfa9a92c2078ba4b5 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 15 Jan 2018 09:15:05 -0800 Subject: [PATCH 031/285] Update to 5.6.39-1debian8 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 1456b6c8a..c8806909f 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -36,7 +36,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.38-1debian8 +ENV MYSQL_VERSION 5.6.39-1debian8 RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 7c72a4561ccf839dace123b9eb5b2c144cdec675 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 15 Feb 2018 09:34:42 -0800 Subject: [PATCH 032/285] Update 8.0 to Debian Stretch --- 8.0/Dockerfile | 9 ++++++--- update.sh | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index e8a58a31e..f698489af 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -1,7 +1,10 @@ -FROM debian:jessie +FROM debian:stretch-slim + # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql +RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* + # add gosu for easy step-down from root ENV GOSU_VERSION 1.7 RUN set -x \ @@ -41,9 +44,9 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.3-rc-1debian8 +ENV MYSQL_VERSION 8.0.4-rc-1debian9 -RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list +RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/update.sh b/update.sh index 8765d979c..cb6f19fac 100755 --- a/update.sh +++ b/update.sh @@ -9,21 +9,45 @@ if [ ${#versions[@]} -eq 0 ]; then fi versions=( "${versions[@]%/}" ) +defaultDebianVariant='stretch-slim' +declare -A debianVariants=( + [5.5]='jessie' + [5.6]='jessie' + [5.7]='jessie' +) + for version in "${versions[@]}"; do + debianVariant="${debianVariants[$version]:-$defaultDebianVariant}" + debianSuite="${debianVariant%%-*}" # "stretch", etc + if [ "$version" = '5.5' ]; then fullVersion="$(curl -sSL "https://dev.mysql.com/downloads/mysql/$version.html?os=2" \ | grep '">(mysql-'"$version"'.*-linux.*-x86_64\.tar\.gz)<' \ | sed -r 's!.*\(mysql-([^<)]+)-linux.*-x86_64\.tar\.gz\).*!\1!' \ | sort -V | tail -1)" else - fullVersion="$(curl -fsSL "http://repo.mysql.com/apt/debian/dists/jessie/mysql-$version/binary-amd64/Packages.gz" | gunzip | awk -F ': ' '$1 == "Package" { pkg = $2; next } pkg == "mysql-server" && $1 == "Version" { print $2 }')" + fullVersion="$( + curl -fsSL "http://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ + | gunzip \ + | awk -F ': ' ' + $1 == "Package" { + pkg = $2 + next + } + pkg == "mysql-server" && $1 == "Version" { + print $2 + } + ' + )" fi - + ( set -x - sed -ri ' - s/^(ENV MYSQL_MAJOR) .*/\1 '"$version"'/; - s/^(ENV MYSQL_VERSION) .*/\1 '"$fullVersion"'/ - ' "$version/Dockerfile" + sed -ri \ + -e 's/^(ENV MYSQL_VERSION) .*/\1 '"$fullVersion"'/' \ + -e 's/^(ENV MYSQL_MAJOR) .*/\1 '"$version"'/' \ + -e 's/^(FROM) .*/\1 debian:'"$debianVariant"'/' \ + -e 's!(http://repo.mysql.com/apt/debian/) [^ ]+!\1 '"$debianSuite"'!' \ + "$version/Dockerfile" ) done From 87a7e96edc3c995a57dc2a4c23c0e32b75c4aaa5 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 16 Feb 2018 16:30:56 -0800 Subject: [PATCH 033/285] Fix "generate-stackbrew-library.sh" to include the full "8.0.4-rc" tag too --- generate-stackbrew-library.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 5acf4a91d..542bb4c77 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -55,7 +55,7 @@ join() { for version in "${versions[@]}"; do commit="$(dirCommit "$version")" - fullVersion="$(git show "$commit":"$version/Dockerfile" | awk '$1 == "ENV" && $2 == "MYSQL_VERSION" { gsub(/-.*$/, "", $3); print $3; exit }')" + fullVersion="$(git show "$commit":"$version/Dockerfile" | awk '$1 == "ENV" && $2 == "MYSQL_VERSION" { gsub(/-[0-9].*$/, "", $3); print $3; exit }')" versionAliases=() while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do From 7b6d186052e268079972b4ea8c871f89161a899e Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 19 Feb 2018 18:31:39 -0800 Subject: [PATCH 034/285] Add "-f" to GNUPGHOME deletions (helps avoid a GnuPG 2.x race condition) --- 8.0/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index f698489af..6d025f2bb 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -14,7 +14,7 @@ RUN set -x \ && export GNUPGHOME="$(mktemp -d)" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ - && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \ + && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true \ && apt-get purge -y --auto-remove ca-certificates wget @@ -40,7 +40,7 @@ RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 From 5d24fc588f78d1703b1bebfd21a5dec385c3b60e Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Thu, 22 Feb 2018 11:58:16 -0800 Subject: [PATCH 035/285] Keep infoschema user since it is required for 8.0.4 Copying change from https://github.com/mysql/mysql-docker/commit/64fd620e7f0c83ef86e01c43f5a0c727b386373c --- 8.0/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 08a8256dd..5b4a5fa64 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -143,7 +143,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - DELETE FROM mysql.user WHERE user NOT IN ('mysql.session', 'mysql.sys', 'root') OR host NOT IN ('localhost') ; + DELETE FROM mysql.user WHERE user NOT IN ('mysql.infoschema', 'mysql.session', 'mysql.sys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; ${rootCreate} From f279c9cc0d20407a2c4d9465adae6b077dcf1b51 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 22 Feb 2018 14:23:02 -0800 Subject: [PATCH 036/285] Update 5.7, 5.6, and 5.5 to "debian:stretch-slim" --- 5.5/Dockerfile | 19 +++++++++++++------ 5.6/Dockerfile | 18 ++++++++++++------ 5.7/Dockerfile | 12 +++++++----- update.sh | 4 +--- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index eca336a2d..dac1c5bde 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -1,8 +1,10 @@ -FROM debian:jessie +FROM debian:stretch-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql +RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* + # add gosu for easy step-down from root ENV GOSU_VERSION 1.7 RUN set -x \ @@ -12,22 +14,27 @@ RUN set -x \ && export GNUPGHOME="$(mktemp -d)" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ - && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \ + && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true \ && apt-get purge -y --auto-remove ca-certificates wget RUN mkdir /docker-entrypoint-initdb.d +RUN apt-get update && apt-get install -y --no-install-recommends \ +# for MYSQL_RANDOM_ROOT_PASSWORD + pwgen \ # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename # File::Copy # Sys::Hostname # Data::Dumper -RUN apt-get update && apt-get install -y perl --no-install-recommends && rm -rf /var/lib/apt/lists/* - + perl \ # mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory -RUN apt-get update && apt-get install -y libaio1 pwgen && rm -rf /var/lib/apt/lists/* + libaio1 \ +# mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory + libncurses5 \ + && rm -rf /var/lib/apt/lists/* ENV MYSQL_MAJOR 5.5 ENV MYSQL_VERSION 5.5.59 @@ -40,7 +47,7 @@ RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recom # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 \ && gpg --batch --verify mysql.tar.gz.asc mysql.tar.gz \ - && rm -r "$GNUPGHOME" mysql.tar.gz.asc \ + && rm -rf "$GNUPGHOME" mysql.tar.gz.asc \ && mkdir /usr/local/mysql \ && tar -xzf mysql.tar.gz -C /usr/local/mysql --strip-components=1 \ && rm mysql.tar.gz \ diff --git a/5.6/Dockerfile b/5.6/Dockerfile index c8806909f..7512a7f01 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -1,8 +1,10 @@ -FROM debian:jessie +FROM debian:stretch-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql +RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* + # add gosu for easy step-down from root ENV GOSU_VERSION 1.7 RUN set -x \ @@ -12,19 +14,23 @@ RUN set -x \ && export GNUPGHOME="$(mktemp -d)" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ - && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \ + && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true \ && apt-get purge -y --auto-remove ca-certificates wget RUN mkdir /docker-entrypoint-initdb.d +RUN apt-get update && apt-get install -y --no-install-recommends \ +# for MYSQL_RANDOM_ROOT_PASSWORD + pwgen \ # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename # File::Copy # Sys::Hostname # Data::Dumper -RUN apt-get update && apt-get install -y perl pwgen --no-install-recommends && rm -rf /var/lib/apt/lists/* + perl \ + && rm -rf /var/lib/apt/lists/* RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported @@ -32,13 +38,13 @@ RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.39-1debian8 +ENV MYSQL_VERSION 5.6.39-1debian9 -RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list +RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 5813c376b..4bf4d9f60 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -1,8 +1,10 @@ -FROM debian:jessie +FROM debian:stretch-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql +RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* + # add gosu for easy step-down from root ENV GOSU_VERSION 1.7 RUN set -x \ @@ -12,7 +14,7 @@ RUN set -x \ && export GNUPGHOME="$(mktemp -d)" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ - && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \ + && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true \ && apt-get purge -y --auto-remove ca-certificates wget @@ -38,13 +40,13 @@ RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.21-1debian8 +ENV MYSQL_VERSION 5.7.21-1debian9 -RUN echo "deb http://repo.mysql.com/apt/debian/ jessie mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list +RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/update.sh b/update.sh index cb6f19fac..da85ee211 100755 --- a/update.sh +++ b/update.sh @@ -11,9 +11,7 @@ versions=( "${versions[@]%/}" ) defaultDebianVariant='stretch-slim' declare -A debianVariants=( - [5.5]='jessie' - [5.6]='jessie' - [5.7]='jessie' + #[5.5]='jessie' ) for version in "${versions[@]}"; do From ad625c64a06e16683e997e5a0147508d115f4989 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Fri, 23 Feb 2018 12:38:04 +0100 Subject: [PATCH 037/285] Drop user deletion from 5.7 and 8.0 MySQL 5.7 and newer no longer creates the various unwanted users (root@various hosts) that were created in older versions, so the deletion isn't needed, and only creates extra maintenance work if any changes to the system users are made. --- 5.7/docker-entrypoint.sh | 1 - 8.0/docker-entrypoint.sh | 1 - 2 files changed, 2 deletions(-) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 08a8256dd..9bd8fd64f 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -143,7 +143,6 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - DELETE FROM mysql.user WHERE user NOT IN ('mysql.session', 'mysql.sys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; ${rootCreate} diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 5b4a5fa64..9bd8fd64f 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -143,7 +143,6 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - DELETE FROM mysql.user WHERE user NOT IN ('mysql.infoschema', 'mysql.session', 'mysql.sys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; ${rootCreate} From 597ac5b2256ed8fd5778b0d599225d4ffc20f2b9 Mon Sep 17 00:00:00 2001 From: Will Palmer Date: Tue, 10 Apr 2018 20:31:41 +0100 Subject: [PATCH 038/285] move init-file processing into a function files found within /docker-entrypoint-initdb.d/* are processed using specific rules based on their filename. It was previously difficult to re-use this logic recursively, or to add logic for handling additional filetypes. By moving this logic into a shell function, we both enable inner shell scripts to easily re-use the same logic (for example, for including files from additional directories or sub-directories), and the possibility of overriding these processing rules entirely, for example to enable handling of additional filename patterns. There is a potential change of functionality compared to the previous version: the mysql command can no-longer be overridden by changing the mysql variable. Instead, the mysql command may be overridden only by overriding the process_init_file() function. There is a potentially loss of functionality in that included scripts can no-longer use "break" to escape the file loop. There is presently no work-around for this, as this is not expected to have been an intended feature. --- 5.5/docker-entrypoint.sh | 26 +++++++++++++++++++------- 5.6/docker-entrypoint.sh | 26 +++++++++++++++++++------- 5.7/docker-entrypoint.sh | 26 +++++++++++++++++++------- 8.0/docker-entrypoint.sh | 26 +++++++++++++++++++------- 4 files changed, 76 insertions(+), 28 deletions(-) diff --git a/5.5/docker-entrypoint.sh b/5.5/docker-entrypoint.sh index 122ff2ddd..fd5ccc2be 100755 --- a/5.5/docker-entrypoint.sh +++ b/5.5/docker-entrypoint.sh @@ -40,6 +40,24 @@ file_env() { unset "$fileVar" } +# usage: process_init_file FILENAME MYSQLCOMMAND... +# ie: process_init_file foo.sh mysql -uroot +# (process a single initializer file, based on its extension. we define this +# function here, so that initializer scripts (*.sh) can use the same logic, +# potentially recursively, or override the logic used in subsequent calls) +process_init_file() { + local f="$1"; shift + local mysql=( "$@" ) + + case "$f" in + *.sh) echo "$0: running $f"; . "$f" ;; + *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; + *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo +} + _check_config() { toRun=( "$@" --verbose --help --log-bin-index="$(mktemp -u)" ) if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then @@ -169,13 +187,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then echo for f in /docker-entrypoint-initdb.d/*; do - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) echo "$0: ignoring $f" ;; - esac - echo + process_init_file "$f" "${mysql[@]}" done if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index e654ea63e..134a4e12d 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -40,6 +40,24 @@ file_env() { unset "$fileVar" } +# usage: process_init_file FILENAME MYSQLCOMMAND... +# ie: process_init_file foo.sh mysql -uroot +# (process a single initializer file, based on its extension. we define this +# function here, so that initializer scripts (*.sh) can use the same logic, +# potentially recursively, or override the logic used in subsequent calls) +process_init_file() { + local f="$1"; shift + local mysql=( "$@" ) + + case "$f" in + *.sh) echo "$0: running $f"; . "$f" ;; + *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; + *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo +} + _check_config() { toRun=( "$@" --verbose --help --log-bin-index="$(mktemp -u)" ) if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then @@ -169,13 +187,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then echo for f in /docker-entrypoint-initdb.d/*; do - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) echo "$0: ignoring $f" ;; - esac - echo + process_init_file "$f" "${mysql[@]}" done if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 9bd8fd64f..112d88c22 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -40,6 +40,24 @@ file_env() { unset "$fileVar" } +# usage: process_init_file FILENAME MYSQLCOMMAND... +# ie: process_init_file foo.sh mysql -uroot +# (process a single initializer file, based on its extension. we define this +# function here, so that initializer scripts (*.sh) can use the same logic, +# potentially recursively, or override the logic used in subsequent calls) +process_init_file() { + local f="$1"; shift + local mysql=( "$@" ) + + case "$f" in + *.sh) echo "$0: running $f"; . "$f" ;; + *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; + *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo +} + _check_config() { toRun=( "$@" --verbose --help ) if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then @@ -174,13 +192,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then echo for f in /docker-entrypoint-initdb.d/*; do - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) echo "$0: ignoring $f" ;; - esac - echo + process_init_file "$f" "${mysql[@]}" done if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 9bd8fd64f..112d88c22 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -40,6 +40,24 @@ file_env() { unset "$fileVar" } +# usage: process_init_file FILENAME MYSQLCOMMAND... +# ie: process_init_file foo.sh mysql -uroot +# (process a single initializer file, based on its extension. we define this +# function here, so that initializer scripts (*.sh) can use the same logic, +# potentially recursively, or override the logic used in subsequent calls) +process_init_file() { + local f="$1"; shift + local mysql=( "$@" ) + + case "$f" in + *.sh) echo "$0: running $f"; . "$f" ;; + *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; + *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo +} + _check_config() { toRun=( "$@" --verbose --help ) if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then @@ -174,13 +192,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then echo for f in /docker-entrypoint-initdb.d/*; do - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) echo "$0: ignoring $f" ;; - esac - echo + process_init_file "$f" "${mysql[@]}" done if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then From 2e4f2224f31e101d07c1e6a7c0da8245fde725c9 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 19 Apr 2018 10:20:42 -0700 Subject: [PATCH 039/285] Fix a few minor issues with docker-entrypoint.sh for 8.0.11 --- 8.0/Dockerfile | 2 +- 8.0/docker-entrypoint.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 6d025f2bb..1d471ad20 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -44,7 +44,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.4-rc-1debian9 +ENV MYSQL_VERSION 8.0.11-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 9bd8fd64f..4f71b04a7 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -59,7 +59,9 @@ _check_config() { # latter only show values present in config files, and not server defaults _get_config() { local conf="$1"; shift - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }' + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ + | awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } # allow the container to be started with `--user` @@ -143,7 +145,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; + ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; ${rootCreate} DROP DATABASE IF EXISTS test ; From e279ec9073b1f7abc16cb1c4e1cd9a2070f2035d Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Thu, 19 Apr 2018 17:31:22 +0000 Subject: [PATCH 040/285] Update to 5.6.40-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 7512a7f01..b454d0c15 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -42,7 +42,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.39-1debian9 +ENV MYSQL_VERSION 5.6.40-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From d32482c96133a97f936fe25881048a794e59159b Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Thu, 19 Apr 2018 17:31:22 +0000 Subject: [PATCH 041/285] Update to 5.5.60 --- 5.5/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index dac1c5bde..5a2bf6d3f 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -37,7 +37,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* ENV MYSQL_MAJOR 5.5 -ENV MYSQL_VERSION 5.5.59 +ENV MYSQL_VERSION 5.5.60 RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.12-x86_64.tar.gz" -O mysql.tar.gz \ From 6662ac76aa1de4f2e0ff036c03281e4022485350 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Thu, 19 Apr 2018 17:31:22 +0000 Subject: [PATCH 042/285] Update to 5.7.22-1debian9 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 4bf4d9f60..aa2441798 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -44,7 +44,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.21-1debian9 +ENV MYSQL_VERSION 5.7.22-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From ff627942605ce08a32fa527993337df0e9856760 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 19 Apr 2018 10:34:44 -0700 Subject: [PATCH 043/285] Move "latest" to 8.0 now that it's GA --- generate-stackbrew-library.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 542bb4c77..a4a7f55d6 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -2,8 +2,8 @@ set -eu declare -A aliases=( - [5.7]='5 latest' - [8.0]='8' + [5.7]='5' + [8.0]='8 latest' ) self="$(basename "$BASH_SOURCE")" From 5c7959ac5ad33349b404a355dbe7dddffa077c80 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 19 Apr 2018 11:04:03 -0700 Subject: [PATCH 044/285] Update generated README https://github.com/docker-library/docs/pull/1193 https://github.com/docker-library/docs/pull/1195 --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cd843174b..9a9e2f88c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,16 @@ -# About this Repo +# https://github.com/docker-library/mysql -This is the Git repo of the Docker [official image](https://docs.docker.com/docker-hub/official_repos/) for [mysql](https://registry.hub.docker.com/_/mysql/). See [the Docker Hub page](https://registry.hub.docker.com/_/mysql/) for the full readme on how to use this Docker image and for information regarding contributing and issues. +## Maintained by: [the Docker Community and the MySQL Team](https://github.com/docker-library/mysql) -The full readme is generated over in [docker-library/docs](https://github.com/docker-library/docs), specifically in [docker-library/docs/mysql](https://github.com/docker-library/docs/tree/master/mysql). +This is the Git repo of the [Docker "Official Image"](https://docs.docker.com/docker-hub/official_repos/) for [mysql](https://hub.docker.com/_/mysql/) (not to be confused with any official mysql image provided by mysql upstream). See [the Docker Hub page](https://hub.docker.com/_/mysql/) for the full readme on how to use this Docker image and for information regarding contributing and issues. -See a change merged here that doesn't show up on the Docker Hub yet? Check [the "library/mysql" manifest file in the docker-library/official-images repo](https://github.com/docker-library/official-images/blob/master/library/mysql), especially [PRs with the "library/mysql" label on that repo](https://github.com/docker-library/official-images/labels/library%2Fmysql). For more information about the official images process, see the [docker-library/official-images readme](https://github.com/docker-library/official-images/blob/master/README.md). +The [full description from Docker Hub](https://hub.docker.com/_/mysql/) is generated over in [docker-library/docs](https://github.com/docker-library/docs), specifically in [docker-library/docs/mysql](https://github.com/docker-library/docs/tree/master/mysql). + +## See a change merged here that doesn't show up on Docker Hub yet? + +Check [the "library/mysql" manifest file in the docker-library/official-images repo](https://github.com/docker-library/official-images/blob/master/library/mysql), especially [PRs with the "library/mysql" label on that repo](https://github.com/docker-library/official-images/labels/library%2Fmysql). + +For more information about the official images process, see the [docker-library/official-images readme](https://github.com/docker-library/official-images/blob/master/README.md). --- @@ -13,4 +19,8 @@ See a change merged here that doesn't show up on the Docker Hub yet? Check [the - [Automated `update.sh`: ![build status badge](https://doi-janky.infosiftr.net/job/update.sh/job/mysql/badge/icon)](https://doi-janky.infosiftr.net/job/update.sh/job/mysql) +| Build | Status | Badges | (per-arch) | +|:-:|:-:|:-:|:-:| +| [`amd64`
![build status badge](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql/badge/icon)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql) | + From 38a16645fb4bc3e537170d003581636ead265aef Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 25 Jul 2018 13:00:53 -0700 Subject: [PATCH 045/285] Add "pgp-happy-eyeballs" in Travis to help cut down on gpg-related issues --- .travis.yml | 10 ++++++++-- 5.5/Dockerfile | 2 ++ 5.6/Dockerfile | 2 ++ 5.7/Dockerfile | 2 ++ 8.0/Dockerfile | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e75ebda4c..096979cca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,12 +12,18 @@ install: before_script: - env | sort + - wget -qO- 'https://github.com/tianon/pgp-happy-eyeballs/raw/master/hack-my-builds.sh' | bash - cd "$VERSION" - image="mysql:$VERSION" script: - - travis_retry docker build -t "$image" . - - ~/official-images/test/run.sh "$image" + - | + ( + set -Eeuo pipefail + set -x + docker build -t "$image" . + ~/official-images/test/run.sh "$image" + ) after_script: - docker images diff --git a/5.5/Dockerfile b/5.5/Dockerfile index 5a2bf6d3f..d86b89f2e 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -14,6 +14,7 @@ RUN set -x \ && export GNUPGHOME="$(mktemp -d)" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ + && gpgconf --kill all \ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true \ @@ -47,6 +48,7 @@ RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recom # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 \ && gpg --batch --verify mysql.tar.gz.asc mysql.tar.gz \ + && gpgconf --kill all \ && rm -rf "$GNUPGHOME" mysql.tar.gz.asc \ && mkdir /usr/local/mysql \ && tar -xzf mysql.tar.gz -C /usr/local/mysql --strip-components=1 \ diff --git a/5.6/Dockerfile b/5.6/Dockerfile index b454d0c15..8ec167bbd 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -14,6 +14,7 @@ RUN set -x \ && export GNUPGHOME="$(mktemp -d)" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ + && gpgconf --kill all \ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true \ @@ -38,6 +39,7 @@ RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + gpgconf --kill all; \ rm -rf "$GNUPGHOME"; \ apt-key list > /dev/null diff --git a/5.7/Dockerfile b/5.7/Dockerfile index aa2441798..954e01751 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -14,6 +14,7 @@ RUN set -x \ && export GNUPGHOME="$(mktemp -d)" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ + && gpgconf --kill all \ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true \ @@ -40,6 +41,7 @@ RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + gpgconf --kill all; \ rm -rf "$GNUPGHOME"; \ apt-key list > /dev/null diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 1d471ad20..a45024d06 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -14,6 +14,7 @@ RUN set -x \ && export GNUPGHOME="$(mktemp -d)" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ + && gpgconf --kill all \ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ && chmod +x /usr/local/bin/gosu \ && gosu nobody true \ @@ -40,6 +41,7 @@ RUN set -ex; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + gpgconf --kill all; \ rm -rf "$GNUPGHOME"; \ apt-key list > /dev/null From 17515d9b32f5c054276ab991f4caf5778e2dbe84 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Fri, 27 Jul 2018 22:15:07 +0000 Subject: [PATCH 046/285] Update to 5.7.23-1debian9 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 954e01751..87aa7e48a 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.22-1debian9 +ENV MYSQL_VERSION 5.7.23-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 51d3fdbf22513522c94c52b1495aae2fcbc4e7c5 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Fri, 27 Jul 2018 22:15:07 +0000 Subject: [PATCH 047/285] Update to 8.0.12-1debian9 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index a45024d06..3f712bb6e 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.11-1debian9 +ENV MYSQL_VERSION 8.0.12-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 0f398dca98cc102a6f781a3f732bfa79d1c2ccee Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Fri, 27 Jul 2018 22:15:07 +0000 Subject: [PATCH 048/285] Update to 5.5.61 --- 5.5/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index d86b89f2e..25d1f568b 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -38,7 +38,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* ENV MYSQL_MAJOR 5.5 -ENV MYSQL_VERSION 5.5.60 +ENV MYSQL_VERSION 5.5.61 RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.12-x86_64.tar.gz" -O mysql.tar.gz \ From 075c24deda2f551531c76ef46283c8c9c810d78f Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Fri, 27 Jul 2018 22:15:07 +0000 Subject: [PATCH 049/285] Update to 5.6.41-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 8ec167bbd..677d59f38 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -44,7 +44,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.40-1debian9 +ENV MYSQL_VERSION 5.6.41-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 381a03b13962b4d93da00370afa096063778889c Mon Sep 17 00:00:00 2001 From: lalyos Date: Mon, 30 Jul 2018 21:01:57 +0200 Subject: [PATCH 050/285] fix silently skipped init scripts --- 5.5/docker-entrypoint.sh | 1 + 5.6/docker-entrypoint.sh | 1 + 5.7/docker-entrypoint.sh | 1 + 8.0/docker-entrypoint.sh | 1 + 4 files changed, 4 insertions(+) diff --git a/5.5/docker-entrypoint.sh b/5.5/docker-entrypoint.sh index fd5ccc2be..cd1855f3f 100755 --- a/5.5/docker-entrypoint.sh +++ b/5.5/docker-entrypoint.sh @@ -186,6 +186,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then fi echo + ls /docker-entrypoint-initdb.d/ > /dev/null for f in /docker-entrypoint-initdb.d/*; do process_init_file "$f" "${mysql[@]}" done diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 134a4e12d..7dbd6975a 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -186,6 +186,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then fi echo + ls /docker-entrypoint-initdb.d/ > /dev/null for f in /docker-entrypoint-initdb.d/*; do process_init_file "$f" "${mysql[@]}" done diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 112d88c22..b38c11287 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -191,6 +191,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then fi echo + ls /docker-entrypoint-initdb.d/ > /dev/null for f in /docker-entrypoint-initdb.d/*; do process_init_file "$f" "${mysql[@]}" done diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 5ed7cd25c..720ef6d65 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -193,6 +193,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then fi echo + ls /docker-entrypoint-initdb.d/ > /dev/null for f in /docker-entrypoint-initdb.d/*; do process_init_file "$f" "${mysql[@]}" done From ef9c8a4948f681c175f46c4fdcdc62dbbc528c07 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 1 Aug 2018 07:31:42 +0200 Subject: [PATCH 051/285] Install mysql-community-client instead of mysql-community-client-core The core package is missing certain utilities user may way, and using it doesn't save all that much in image size --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 3f712bb6e..8dd69ee5a 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -58,7 +58,7 @@ RUN { \ echo mysql-community-server mysql-community-server/re-root-pass password ''; \ echo mysql-community-server mysql-community-server/remove-test-db select false; \ } | debconf-set-selections \ - && apt-get update && apt-get install -y mysql-community-client-core="${MYSQL_VERSION}" mysql-community-server-core="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \ + && apt-get update && apt-get install -y mysql-community-client="${MYSQL_VERSION}" mysql-community-server-core="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime From 9d1f62552b5dcf25d3102f14eb82b579ce9f4a26 Mon Sep 17 00:00:00 2001 From: Graham Pinhey Date: Wed, 1 Aug 2018 14:12:15 -0600 Subject: [PATCH 052/285] Expose mysqlx port --- 5.7/Dockerfile | 2 +- 8.0/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 87aa7e48a..eed524cf1 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -76,5 +76,5 @@ COPY docker-entrypoint.sh /usr/local/bin/ RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] -EXPOSE 3306 +EXPOSE 3306 33060 CMD ["mysqld"] diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 3f712bb6e..c5d5787e2 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -71,5 +71,5 @@ COPY docker-entrypoint.sh /usr/local/bin/ RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] -EXPOSE 3306 +EXPOSE 3306 33060 CMD ["mysqld"] From 37aee3a187904f07d41ce5fa3cc0fb43c08ffaf5 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 21 Oct 2018 22:15:09 +0000 Subject: [PATCH 053/285] Update to 5.6.42-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 677d59f38..48ec1b10c 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -44,7 +44,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.41-1debian9 +ENV MYSQL_VERSION 5.6.42-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From b7c899673a214df4c8027a498c64eec7145ba479 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 21 Oct 2018 22:15:09 +0000 Subject: [PATCH 054/285] Update to 5.7.24-1debian9 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index eed524cf1..987d80c9c 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.23-1debian9 +ENV MYSQL_VERSION 5.7.24-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 223f0be1213bbd8647b841243a3114e8b34022f4 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 21 Oct 2018 22:15:09 +0000 Subject: [PATCH 055/285] Update to 8.0.13-1debian9 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index d5e9eb8c3..e17d49b47 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.12-1debian9 +ENV MYSQL_VERSION 8.0.13-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 7ca585ee4356dd2c912708f24d877967dab51cdd Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 22 Oct 2018 10:15:05 +0000 Subject: [PATCH 056/285] Update to 5.5.62 --- 5.5/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index 25d1f568b..83f001cec 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -38,7 +38,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* ENV MYSQL_MAJOR 5.5 -ENV MYSQL_VERSION 5.5.61 +ENV MYSQL_VERSION 5.5.62 RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.12-x86_64.tar.gz" -O mysql.tar.gz \ From 696fc899126ae00771b5d87bdadae836e704ae7d Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 14 Nov 2018 12:41:41 -0800 Subject: [PATCH 057/285] Update "gpg" invocations to use "--batch" See https://bugs.debian.org/913614 --- 5.5/Dockerfile | 4 ++-- 5.6/Dockerfile | 6 +++--- 5.7/Dockerfile | 6 +++--- 8.0/Dockerfile | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/5.5/Dockerfile b/5.5/Dockerfile index 83f001cec..f3f04d2ea 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -12,7 +12,7 @@ RUN set -x \ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ && export GNUPGHOME="$(mktemp -d)" \ - && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ && gpgconf --kill all \ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ @@ -46,7 +46,7 @@ RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recom && apt-get purge -y --auto-remove ca-certificates wget \ && export GNUPGHOME="$(mktemp -d)" \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported - && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 \ + && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 \ && gpg --batch --verify mysql.tar.gz.asc mysql.tar.gz \ && gpgconf --kill all \ && rm -rf "$GNUPGHOME" mysql.tar.gz.asc \ diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 48ec1b10c..a17411f0c 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -12,7 +12,7 @@ RUN set -x \ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ && export GNUPGHOME="$(mktemp -d)" \ - && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ && gpgconf --kill all \ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ @@ -37,8 +37,8 @@ RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ export GNUPGHOME="$(mktemp -d)"; \ - gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ - gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ gpgconf --kill all; \ rm -rf "$GNUPGHOME"; \ apt-key list > /dev/null diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 987d80c9c..4ba412e63 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -12,7 +12,7 @@ RUN set -x \ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ && export GNUPGHOME="$(mktemp -d)" \ - && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ && gpgconf --kill all \ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ @@ -39,8 +39,8 @@ RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ export GNUPGHOME="$(mktemp -d)"; \ - gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ - gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ gpgconf --kill all; \ rm -rf "$GNUPGHOME"; \ apt-key list > /dev/null diff --git a/8.0/Dockerfile b/8.0/Dockerfile index e17d49b47..5b566f466 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -12,7 +12,7 @@ RUN set -x \ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ && export GNUPGHOME="$(mktemp -d)" \ - && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ && gpgconf --kill all \ && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ @@ -39,8 +39,8 @@ RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ export GNUPGHOME="$(mktemp -d)"; \ - gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ - gpg --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ gpgconf --kill all; \ rm -rf "$GNUPGHOME"; \ apt-key list > /dev/null From c0454b9e0ede6050deb66e2aabbc213b11b3eefe Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 20 Jan 2019 23:15:05 +0000 Subject: [PATCH 058/285] Update to 5.6.43-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index a17411f0c..e8218391e 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -44,7 +44,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.42-1debian9 +ENV MYSQL_VERSION 5.6.43-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From bb7ea52db4e12d3fb526450d22382d5cd8cd41ca Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 20 Jan 2019 23:15:05 +0000 Subject: [PATCH 059/285] Update to 5.7.25-1debian9 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 4ba412e63..debfdb3fe 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.24-1debian9 +ENV MYSQL_VERSION 5.7.25-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 401385db80c61290d25c0a6c1c86bbf9d6552f4d Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 20 Jan 2019 23:15:05 +0000 Subject: [PATCH 060/285] Update to 8.0.14-1debian9 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 5b566f466..bcc5943e0 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.13-1debian9 +ENV MYSQL_VERSION 8.0.14-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From a7a737f1eb44db467c85c8229df9d886dd63460e Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Fri, 1 Feb 2019 17:15:10 +0000 Subject: [PATCH 061/285] Update to 8.0.15-1debian9 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index bcc5943e0..3ff5ce56a 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.14-1debian9 +ENV MYSQL_VERSION 8.0.15-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 130bd8e46a3da1adfc1732a08c70673e20aa5977 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Wed, 24 Apr 2019 22:15:09 +0000 Subject: [PATCH 062/285] Update to 8.0.16-1debian9 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 3ff5ce56a..a7f1e2453 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.15-1debian9 +ENV MYSQL_VERSION 8.0.16-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 26380f33a0fcd07dda35e37516eb24eaf962845c Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Wed, 24 Apr 2019 22:15:09 +0000 Subject: [PATCH 063/285] Update to 5.7.26-1debian9 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index debfdb3fe..22ceada67 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.25-1debian9 +ENV MYSQL_VERSION 5.7.26-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 38510a26f56f429817da7cabf5c772756faa5e55 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Wed, 24 Apr 2019 22:15:09 +0000 Subject: [PATCH 064/285] Update to 5.6.44-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index e8218391e..cb159711f 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -44,7 +44,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.43-1debian9 +ENV MYSQL_VERSION 5.6.44-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 3362baccb4352bcf0022014f67c1ec7e6808b8c5 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 7 May 2019 16:15:06 +0000 Subject: [PATCH 065/285] Update to 8.0.16-2debian9 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index a7f1e2453..d2e24a2d5 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.16-1debian9 +ENV MYSQL_VERSION 8.0.16-2debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 98f958b67cf45af464c3ad4521a1e2af71398650 Mon Sep 17 00:00:00 2001 From: J0WI Date: Tue, 21 May 2019 22:03:04 +0200 Subject: [PATCH 066/285] Remove EOL 5.5 --- .travis.yml | 1 - 5.5/Dockerfile | 87 ---------------- 5.5/docker-entrypoint.sh | 210 --------------------------------------- update.sh | 33 +++--- 4 files changed, 13 insertions(+), 318 deletions(-) delete mode 100644 5.5/Dockerfile delete mode 100755 5.5/docker-entrypoint.sh diff --git a/.travis.yml b/.travis.yml index 096979cca..bc09ca645 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ env: - VERSION=8.0 - VERSION=5.7 - VERSION=5.6 - - VERSION=5.5 install: - git clone https://github.com/docker-library/official-images.git ~/official-images diff --git a/5.5/Dockerfile b/5.5/Dockerfile deleted file mode 100644 index f3f04d2ea..000000000 --- a/5.5/Dockerfile +++ /dev/null @@ -1,87 +0,0 @@ -FROM debian:stretch-slim - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN groupadd -r mysql && useradd -r -g mysql mysql - -RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* - -# add gosu for easy step-down from root -ENV GOSU_VERSION 1.7 -RUN set -x \ - && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ - && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ - && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ - && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ - && gpgconf --kill all \ - && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ - && chmod +x /usr/local/bin/gosu \ - && gosu nobody true \ - && apt-get purge -y --auto-remove ca-certificates wget - -RUN mkdir /docker-entrypoint-initdb.d - -RUN apt-get update && apt-get install -y --no-install-recommends \ -# for MYSQL_RANDOM_ROOT_PASSWORD - pwgen \ -# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: -# File::Basename -# File::Copy -# Sys::Hostname -# Data::Dumper - perl \ -# mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory - libaio1 \ -# mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory - libncurses5 \ - && rm -rf /var/lib/apt/lists/* - -ENV MYSQL_MAJOR 5.5 -ENV MYSQL_VERSION 5.5.62 - -RUN apt-get update && apt-get install -y ca-certificates wget --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.12-x86_64.tar.gz" -O mysql.tar.gz \ - && wget "https://cdn.mysql.com/Downloads/MySQL-$MYSQL_MAJOR/mysql-$MYSQL_VERSION-linux-glibc2.12-x86_64.tar.gz.asc" -O mysql.tar.gz.asc \ - && apt-get purge -y --auto-remove ca-certificates wget \ - && export GNUPGHOME="$(mktemp -d)" \ -# gpg: key 5072E1F5: public key "MySQL Release Engineering " imported - && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5 \ - && gpg --batch --verify mysql.tar.gz.asc mysql.tar.gz \ - && gpgconf --kill all \ - && rm -rf "$GNUPGHOME" mysql.tar.gz.asc \ - && mkdir /usr/local/mysql \ - && tar -xzf mysql.tar.gz -C /usr/local/mysql --strip-components=1 \ - && rm mysql.tar.gz \ - && rm -rf /usr/local/mysql/mysql-test /usr/local/mysql/sql-bench \ - && rm -rf /usr/local/mysql/bin/*-debug /usr/local/mysql/bin/*_embedded \ - && find /usr/local/mysql -type f -name "*.a" -delete \ - && apt-get update && apt-get install -y binutils && rm -rf /var/lib/apt/lists/* \ - && { find /usr/local/mysql -type f -executable -exec strip --strip-all '{}' + || true; } \ - && apt-get purge -y --auto-remove binutils -ENV PATH $PATH:/usr/local/mysql/bin:/usr/local/mysql/scripts - -# replicate some of the way the APT package configuration works -# this is only for 5.5 since it doesn't have an APT repo, and will go away when 5.5 does -RUN mkdir -p /etc/mysql/conf.d \ - && { \ - echo '[mysqld]'; \ - echo 'skip-host-cache'; \ - echo 'skip-name-resolve'; \ - echo 'datadir = /var/lib/mysql'; \ - echo '!includedir /etc/mysql/conf.d/'; \ - } > /etc/mysql/my.cnf - -RUN mkdir -p /var/lib/mysql /var/run/mysqld \ - && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 777 /var/run/mysqld - -VOLUME /var/lib/mysql - -COPY docker-entrypoint.sh /usr/local/bin/ -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -EXPOSE 3306 -CMD ["mysqld"] diff --git a/5.5/docker-entrypoint.sh b/5.5/docker-entrypoint.sh deleted file mode 100755 index cd1855f3f..000000000 --- a/5.5/docker-entrypoint.sh +++ /dev/null @@ -1,210 +0,0 @@ -#!/bin/bash -set -eo pipefail -shopt -s nullglob - -# if command starts with an option, prepend mysqld -if [ "${1:0:1}" = '-' ]; then - set -- mysqld "$@" -fi - -# skip setup if they want an option that stops mysqld -wantHelp= -for arg; do - case "$arg" in - -'?'|--help|--print-defaults|-V|--version) - wantHelp=1 - break - ;; - esac -done - -# usage: file_env VAR [DEFAULT] -# ie: file_env 'XYZ_DB_PASSWORD' 'example' -# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of -# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) -file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 - fi - local val="$def" - if [ "${!var:-}" ]; then - val="${!var}" - elif [ "${!fileVar:-}" ]; then - val="$(< "${!fileVar}")" - fi - export "$var"="$val" - unset "$fileVar" -} - -# usage: process_init_file FILENAME MYSQLCOMMAND... -# ie: process_init_file foo.sh mysql -uroot -# (process a single initializer file, based on its extension. we define this -# function here, so that initializer scripts (*.sh) can use the same logic, -# potentially recursively, or override the logic used in subsequent calls) -process_init_file() { - local f="$1"; shift - local mysql=( "$@" ) - - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) echo "$0: ignoring $f" ;; - esac - echo -} - -_check_config() { - toRun=( "$@" --verbose --help --log-bin-index="$(mktemp -u)" ) - if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - cat >&2 <<-EOM - - ERROR: mysqld failed while attempting to check config - command was: "${toRun[*]}" - - $errors - EOM - exit 1 - fi -} - -# Fetch value from server config -# We use mysqld --verbose --help instead of my_print_defaults because the -# latter only show values present in config files, and not server defaults -_get_config() { - local conf="$1"; shift - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }' -} - -# allow the container to be started with `--user` -if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then - _check_config "$@" - DATADIR="$(_get_config 'datadir' "$@")" - mkdir -p "$DATADIR" - chown -R mysql:mysql "$DATADIR" - exec gosu mysql "$BASH_SOURCE" "$@" -fi - -if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then - # still need to check config, container may have started with --user - _check_config "$@" - # Get config - DATADIR="$(_get_config 'datadir' "$@")" - - if [ ! -d "$DATADIR/mysql" ]; then - file_env 'MYSQL_ROOT_PASSWORD' - if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - echo >&2 'error: database is uninitialized and password option is not specified ' - echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' - exit 1 - fi - - mkdir -p "$DATADIR" - - echo 'Initializing database' - # "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here) - mysql_install_db --datadir="$DATADIR" --rpm --basedir=/usr/local/mysql "${@:2}" - echo 'Database initialized' - - SOCKET="$(_get_config 'socket' "$@")" - "$@" --skip-networking --basedir=/usr/local/mysql --socket="${SOCKET}" & - pid="$!" - - mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) - - for i in {30..0}; do - if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then - break - fi - echo 'MySQL init process in progress...' - sleep 1 - done - if [ "$i" = 0 ]; then - echo >&2 'MySQL init process failed.' - exit 1 - fi - - if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then - # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql - fi - - if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" - echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" - fi - - rootCreate= - # default root to listen for connections from anywhere - file_env 'MYSQL_ROOT_HOST' '%' - if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then - # no, we don't care if read finds a terminating character in this heredoc - # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 - read -r -d '' rootCreate <<-EOSQL || true - CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ; - EOSQL - fi - - "${mysql[@]}" <<-EOSQL - -- What's done in this file shouldn't be replicated - -- or products like mysql-fabric won't work - SET @@SESSION.SQL_LOG_BIN=0; - - DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; - SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; - GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; - ${rootCreate} - DROP DATABASE IF EXISTS test ; - FLUSH PRIVILEGES ; - EOSQL - - if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then - mysql+=( -p"${MYSQL_ROOT_PASSWORD}" ) - fi - - file_env 'MYSQL_DATABASE' - if [ "$MYSQL_DATABASE" ]; then - echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}" - mysql+=( "$MYSQL_DATABASE" ) - fi - - file_env 'MYSQL_USER' - file_env 'MYSQL_PASSWORD' - if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then - echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}" - - if [ "$MYSQL_DATABASE" ]; then - echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" | "${mysql[@]}" - fi - - echo 'FLUSH PRIVILEGES ;' | "${mysql[@]}" - fi - - echo - ls /docker-entrypoint-initdb.d/ > /dev/null - for f in /docker-entrypoint-initdb.d/*; do - process_init_file "$f" "${mysql[@]}" - done - - if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - 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.' - exit 1 - fi - - echo - echo 'MySQL init process done. Ready for start up.' - echo - fi -fi - -exec "$@" diff --git a/update.sh b/update.sh index da85ee211..5b725e647 100755 --- a/update.sh +++ b/update.sh @@ -18,26 +18,19 @@ for version in "${versions[@]}"; do debianVariant="${debianVariants[$version]:-$defaultDebianVariant}" debianSuite="${debianVariant%%-*}" # "stretch", etc - if [ "$version" = '5.5' ]; then - fullVersion="$(curl -sSL "https://dev.mysql.com/downloads/mysql/$version.html?os=2" \ - | grep '">(mysql-'"$version"'.*-linux.*-x86_64\.tar\.gz)<' \ - | sed -r 's!.*\(mysql-([^<)]+)-linux.*-x86_64\.tar\.gz\).*!\1!' \ - | sort -V | tail -1)" - else - fullVersion="$( - curl -fsSL "http://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ - | gunzip \ - | awk -F ': ' ' - $1 == "Package" { - pkg = $2 - next - } - pkg == "mysql-server" && $1 == "Version" { - print $2 - } - ' - )" - fi + fullVersion="$( + curl -fsSL "http://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ + | gunzip \ + | awk -F ': ' ' + $1 == "Package" { + pkg = $2 + next + } + pkg == "mysql-server" && $1 == "Version" { + print $2 + } + ' + )" ( set -x From 079f14e683025c9dde02f20da575fa2f4149fe2d Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 13 Jun 2019 16:18:19 -0700 Subject: [PATCH 067/285] Update generated README Especially to link to the new FAQ entry (https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what) --- README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9a9e2f88c..2e3686d9c 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,23 @@ ## Maintained by: [the Docker Community and the MySQL Team](https://github.com/docker-library/mysql) -This is the Git repo of the [Docker "Official Image"](https://docs.docker.com/docker-hub/official_repos/) for [mysql](https://hub.docker.com/_/mysql/) (not to be confused with any official mysql image provided by mysql upstream). See [the Docker Hub page](https://hub.docker.com/_/mysql/) for the full readme on how to use this Docker image and for information regarding contributing and issues. +This is the Git repo of the [Docker "Official Image"](https://github.com/docker-library/official-images#what-are-official-images) for [`mysql`](https://hub.docker.com/_/mysql/) (not to be confused with any official `mysql` image provided by `mysql` upstream). See [the Docker Hub page](https://hub.docker.com/_/mysql/) for the full readme on how to use this Docker image and for information regarding contributing and issues. -The [full description from Docker Hub](https://hub.docker.com/_/mysql/) is generated over in [docker-library/docs](https://github.com/docker-library/docs), specifically in [docker-library/docs/mysql](https://github.com/docker-library/docs/tree/master/mysql). +The [full image description on Docker Hub](https://hub.docker.com/_/mysql/) is generated/maintained over in [the docker-library/docs repository](https://github.com/docker-library/docs), specifically in [the `mysql` directory](https://github.com/docker-library/docs/tree/master/mysql). ## See a change merged here that doesn't show up on Docker Hub yet? -Check [the "library/mysql" manifest file in the docker-library/official-images repo](https://github.com/docker-library/official-images/blob/master/library/mysql), especially [PRs with the "library/mysql" label on that repo](https://github.com/docker-library/official-images/labels/library%2Fmysql). +For more information about the full official images change lifecycle, see [the "An image's source changed in Git, now what?" FAQ entry](https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what). -For more information about the official images process, see the [docker-library/official-images readme](https://github.com/docker-library/official-images/blob/master/README.md). +For outstanding `mysql` image PRs, check [PRs with the "library/mysql" label on the official-images repository](https://github.com/docker-library/official-images/labels/library%2Fmysql). For the current "source of truth" for [`mysql`](https://hub.docker.com/_/mysql/), see [the `library/mysql` file in the official-images repository](https://github.com/docker-library/official-images/blob/master/library/mysql). --- -- [Travis CI: - ![build status badge](https://img.shields.io/travis/docker-library/mysql/master.svg)](https://travis-ci.org/docker-library/mysql/branches) -- [Automated `update.sh`: - ![build status badge](https://doi-janky.infosiftr.net/job/update.sh/job/mysql/badge/icon)](https://doi-janky.infosiftr.net/job/update.sh/job/mysql) +- [![build status badge](https://img.shields.io/travis/docker-library/mysql/master.svg?label=Travis%20CI)](https://travis-ci.org/docker-library/mysql/branches) +- [![build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/mysql.svg?label=Automated%20update.sh)](https://doi-janky.infosiftr.net/job/update.sh/job/mysql) | Build | Status | Badges | (per-arch) | |:-:|:-:|:-:|:-:| -| [`amd64`
![build status badge](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql/badge/icon)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql) | +| [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql) | From ed0e47e48b8ca3dbc4d68d68f56384bdd1fb5cdb Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 21 Jul 2019 16:15:06 +0000 Subject: [PATCH 068/285] Update to 5.6.45-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index cb159711f..ac00a2217 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -44,7 +44,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.44-1debian9 +ENV MYSQL_VERSION 5.6.45-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 4af273a07854d7e4b68c5148b8e23b86aa8706e2 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 21 Jul 2019 16:15:06 +0000 Subject: [PATCH 069/285] Update to 8.0.17-1debian9 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index d2e24a2d5..c952b9862 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.16-2debian9 +ENV MYSQL_VERSION 8.0.17-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 51f9523ad07abacbce90c43eb27390c1c1f76266 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 21 Jul 2019 16:15:06 +0000 Subject: [PATCH 070/285] Update to 5.7.27-1debian9 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 22ceada67..b698e6a9e 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.26-1debian9 +ENV MYSQL_VERSION 5.7.27-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 0f338484d3ba4613decc869a8a20fdb6d7120397 Mon Sep 17 00:00:00 2001 From: J0WI Date: Tue, 6 Aug 2019 02:02:47 +0200 Subject: [PATCH 071/285] Use https in update.sh --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 5b725e647..db67d2158 100755 --- a/update.sh +++ b/update.sh @@ -19,7 +19,7 @@ for version in "${versions[@]}"; do debianSuite="${debianVariant%%-*}" # "stretch", etc fullVersion="$( - curl -fsSL "http://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ + curl -fsSL "https://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ | gunzip \ | awk -F ': ' ' $1 == "Package" { From d56d41dd7ceb73084f42c775f133ef013ab5ff1c Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 3 Sep 2019 15:10:49 -0700 Subject: [PATCH 072/285] Update generated README Especially to link to put-shared jobs (https://doi-janky.infosiftr.net/job/put-shared/) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e3686d9c..b71c48de5 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,6 @@ For outstanding `mysql` image PRs, check [PRs with the "library/mysql" label on | Build | Status | Badges | (per-arch) | |:-:|:-:|:-:|:-:| -| [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql) | +| [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql) | [![put-shared build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql.svg?label=put-shared)](https://doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql) | From f16150ea70bdae87b9fcc64e01441086749be244 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 28 May 2018 09:06:19 +0200 Subject: [PATCH 073/285] Unify entrypoint scripts for 5.7 and 8.0 There were only two differences between the scripts: * 8.0 had a fix for datadir settings with spaces in them * 8.0 used alter user to set the root password, which 5.7 should also use --- 5.7/docker-entrypoint.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index b38c11287..720ef6d65 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -77,7 +77,9 @@ _check_config() { # latter only show values present in config files, and not server defaults _get_config() { local conf="$1"; shift - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }' + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ + | awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } # allow the container to be started with `--user` @@ -161,7 +163,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; + ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; ${rootCreate} DROP DATABASE IF EXISTS test ; From 5a727ad690eb683549ab1165e5970d90d9619ba2 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 28 May 2018 09:24:16 +0200 Subject: [PATCH 074/285] Make template for 5.7+ entrypoint script 5.7 and 8.0 can use the exact same entrypoint script, so simply have the update script copy it from a template location. --- template.Debian/docker-entrypoint.sh | 216 +++++++++++++++++++++++++++ update.sh | 7 + 2 files changed, 223 insertions(+) create mode 100755 template.Debian/docker-entrypoint.sh diff --git a/template.Debian/docker-entrypoint.sh b/template.Debian/docker-entrypoint.sh new file mode 100755 index 000000000..5ed7cd25c --- /dev/null +++ b/template.Debian/docker-entrypoint.sh @@ -0,0 +1,216 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +# if command starts with an option, prepend mysqld +if [ "${1:0:1}" = '-' ]; then + set -- mysqld "$@" +fi + +# skip setup if they want an option that stops mysqld +wantHelp= +for arg; do + case "$arg" in + -'?'|--help|--print-defaults|-V|--version) + wantHelp=1 + break + ;; + esac +done + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + local val="$def" + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + export "$var"="$val" + unset "$fileVar" +} + +# usage: process_init_file FILENAME MYSQLCOMMAND... +# ie: process_init_file foo.sh mysql -uroot +# (process a single initializer file, based on its extension. we define this +# function here, so that initializer scripts (*.sh) can use the same logic, +# potentially recursively, or override the logic used in subsequent calls) +process_init_file() { + local f="$1"; shift + local mysql=( "$@" ) + + case "$f" in + *.sh) echo "$0: running $f"; . "$f" ;; + *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; + *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo +} + +_check_config() { + toRun=( "$@" --verbose --help ) + if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then + cat >&2 <<-EOM + + ERROR: mysqld failed while attempting to check config + command was: "${toRun[*]}" + + $errors + EOM + exit 1 + fi +} + +# Fetch value from server config +# We use mysqld --verbose --help instead of my_print_defaults because the +# latter only show values present in config files, and not server defaults +_get_config() { + local conf="$1"; shift + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ + | awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" +} + +# allow the container to be started with `--user` +if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then + _check_config "$@" + DATADIR="$(_get_config 'datadir' "$@")" + mkdir -p "$DATADIR" + chown -R mysql:mysql "$DATADIR" + exec gosu mysql "$BASH_SOURCE" "$@" +fi + +if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then + # still need to check config, container may have started with --user + _check_config "$@" + # Get config + DATADIR="$(_get_config 'datadir' "$@")" + + if [ ! -d "$DATADIR/mysql" ]; then + file_env 'MYSQL_ROOT_PASSWORD' + if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + echo >&2 'error: database is uninitialized and password option is not specified ' + echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' + exit 1 + fi + + mkdir -p "$DATADIR" + + echo 'Initializing database' + "$@" --initialize-insecure + echo 'Database initialized' + + if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then + # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 + echo 'Initializing certificates' + mysql_ssl_rsa_setup --datadir="$DATADIR" + echo 'Certificates initialized' + fi + + SOCKET="$(_get_config 'socket' "$@")" + "$@" --skip-networking --socket="${SOCKET}" & + pid="$!" + + mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) + + for i in {30..0}; do + if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then + break + fi + echo 'MySQL init process in progress...' + sleep 1 + done + if [ "$i" = 0 ]; then + echo >&2 'MySQL init process failed.' + exit 1 + fi + + if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then + # sed is for https://bugs.mysql.com/bug.php?id=20545 + mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql + fi + + if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" + echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" + fi + + rootCreate= + # default root to listen for connections from anywhere + file_env 'MYSQL_ROOT_HOST' '%' + if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then + # no, we don't care if read finds a terminating character in this heredoc + # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 + read -r -d '' rootCreate <<-EOSQL || true + CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ; + EOSQL + fi + + "${mysql[@]}" <<-EOSQL + -- What's done in this file shouldn't be replicated + -- or products like mysql-fabric won't work + SET @@SESSION.SQL_LOG_BIN=0; + + ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; + ${rootCreate} + DROP DATABASE IF EXISTS test ; + FLUSH PRIVILEGES ; + EOSQL + + if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then + mysql+=( -p"${MYSQL_ROOT_PASSWORD}" ) + fi + + file_env 'MYSQL_DATABASE' + if [ "$MYSQL_DATABASE" ]; then + echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}" + mysql+=( "$MYSQL_DATABASE" ) + fi + + file_env 'MYSQL_USER' + file_env 'MYSQL_PASSWORD' + if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then + echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}" + + if [ "$MYSQL_DATABASE" ]; then + echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" | "${mysql[@]}" + fi + + echo 'FLUSH PRIVILEGES ;' | "${mysql[@]}" + fi + + echo + for f in /docker-entrypoint-initdb.d/*; do + process_init_file "$f" "${mysql[@]}" + done + + if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then + "${mysql[@]}" <<-EOSQL + ALTER USER 'root'@'%' PASSWORD EXPIRE; + EOSQL + fi + if ! kill -s TERM "$pid" || ! wait "$pid"; then + echo >&2 'MySQL init process failed.' + exit 1 + fi + + echo + echo 'MySQL init process done. Ready for start up.' + echo + fi +fi + +exec "$@" diff --git a/update.sh b/update.sh index db67d2158..f28ad3f14 100755 --- a/update.sh +++ b/update.sh @@ -14,7 +14,14 @@ declare -A debianVariants=( #[5.5]='jessie' ) +# Copy entrypoint template +templateVersions=( "5.7 8.0" ) +for version in ${templateVersions}; do + cp "template.Debian/docker-entrypoint.sh" "${version}/" +done + for version in "${versions[@]}"; do + if [ "${version}" = "template.Debian" ]; then continue; fi # If update.sh is run without arguments, the template directory is included in the list debianVariant="${debianVariants[$version]:-$defaultDebianVariant}" debianSuite="${debianVariant%%-*}" # "stretch", etc From afceb7f478620cd7f2825bcbaad159314dd59840 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 6 Aug 2018 10:13:25 +0200 Subject: [PATCH 075/285] Template: Create functions for starting and stopping server during init Move the logic for doing temporary startup of the server during init to functions. Also add tags to echo commands to make it clear they are coming from the entrypoint script. --- template.Debian/docker-entrypoint.sh | 88 +++++++++++++++++----------- 1 file changed, 55 insertions(+), 33 deletions(-) diff --git a/template.Debian/docker-entrypoint.sh b/template.Debian/docker-entrypoint.sh index 5ed7cd25c..86e0398cc 100755 --- a/template.Debian/docker-entrypoint.sh +++ b/template.Debian/docker-entrypoint.sh @@ -27,7 +27,7 @@ file_env() { local fileVar="${var}_FILE" local def="${2:-}" if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + echo >&2 "$(date --rfc-3339=seconds) [ERROR] [Entrypoint]: Both $var and $fileVar are set (but are exclusive)" exit 1 fi local val="$def" @@ -50,10 +50,10 @@ process_init_file() { local mysql=( "$@" ) case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) echo "$0: ignoring $f" ;; + *.sh) echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: $0: running $f"; . "$f" ;; + *.sql) echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: $0: running $f"; "${mysql[@]}" < "$f"; echo ;; + *.sql.gz) echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: $0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; + *) echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: $0: ignoring $f" ;; esac echo } @@ -61,9 +61,10 @@ process_init_file() { _check_config() { toRun=( "$@" --verbose --help ) if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then + datestring=$(date --rfc-3339=seconds) cat >&2 <<-EOM - ERROR: mysqld failed while attempting to check config + $datestring [ERROR] [Entrypoint]: mysqld failed while attempting to check config command was: "${toRun[*]}" $errors @@ -82,6 +83,40 @@ _get_config() { # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } +_start_server() { + local socket=$1; shift + "$@" --skip-networking --socket="${socket}" & + local pid="$!" + + mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${socket}" ) + + for i in {30..0}; do + if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then + break + fi + sleep 1 + done + if [ "$i" = 0 ]; then + echo >&2 "$(date --rfc-3339=seconds) [ERROR] [Entrypoint]: Unable to start server." + exit 1 + fi + return $pid +} + +_stop_server() { + local server_pid="$1" + kill "$server_pid" + for i in $(seq 1 60); do + sleep 1 + if ! $(pidof /usr/sbin/mysqld >/dev/null 2>&1); then + return 0 + fi + done + # The server hasn't shut down in a timely manner + echo "$(date --rfc-3339=seconds) [ERROR] [Entrypoint]: Unable to shut down server with process id $server_pid" >&2 + return 1 + +} # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then _check_config "$@" @@ -100,42 +135,31 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then if [ ! -d "$DATADIR/mysql" ]; then file_env 'MYSQL_ROOT_PASSWORD' if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - echo >&2 'error: database is uninitialized and password option is not specified ' - echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' + echo >&2 "$(date --rfc-3339=seconds) [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified " + echo >&2 "$(date --rfc-3339=seconds) [ERROR] [Entrypoint]: You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" exit 1 fi mkdir -p "$DATADIR" - echo 'Initializing database' + echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Initializing database" "$@" --initialize-insecure - echo 'Database initialized' + echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Database initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - echo 'Initializing certificates' + echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Initializing certificates" mysql_ssl_rsa_setup --datadir="$DATADIR" - echo 'Certificates initialized' + echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Certificates initialized" fi SOCKET="$(_get_config 'socket' "$@")" - "$@" --skip-networking --socket="${SOCKET}" & - pid="$!" + echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Starting server" + _start_server "${SOCKET}" "$@" || pid=$? + echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Server started with pid $pid" mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) - for i in {30..0}; do - if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then - break - fi - echo 'MySQL init process in progress...' - sleep 1 - done - if [ "$i" = 0 ]; then - echo >&2 'MySQL init process failed.' - exit 1 - fi - if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then # sed is for https://bugs.mysql.com/bug.php?id=20545 mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql @@ -143,7 +167,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" - echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" + echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi rootCreate= @@ -202,13 +226,11 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then ALTER USER 'root'@'%' PASSWORD EXPIRE; EOSQL fi - if ! kill -s TERM "$pid" || ! wait "$pid"; then - echo >&2 'MySQL init process failed.' - exit 1 - fi - + echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Stopping server" + _stop_server $pid + echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Server stopped" echo - echo 'MySQL init process done. Ready for start up.' + echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: MySQL init process done. Ready for start up." echo fi fi From 34f3ef2bb66b0525fb6bac8bd87d3a6a2655b1b1 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 22 Aug 2018 08:42:40 +0200 Subject: [PATCH 076/285] Template: Rename template directory to be hidden Renamed from template.Debian to .template.Debian so the update script won't see it as a build directory. --- {template.Debian => .template.Debian}/docker-entrypoint.sh | 0 update.sh | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) rename {template.Debian => .template.Debian}/docker-entrypoint.sh (100%) diff --git a/template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh similarity index 100% rename from template.Debian/docker-entrypoint.sh rename to .template.Debian/docker-entrypoint.sh diff --git a/update.sh b/update.sh index f28ad3f14..41dfec7cb 100755 --- a/update.sh +++ b/update.sh @@ -17,11 +17,10 @@ declare -A debianVariants=( # Copy entrypoint template templateVersions=( "5.7 8.0" ) for version in ${templateVersions}; do - cp "template.Debian/docker-entrypoint.sh" "${version}/" + cp ".template.Debian/docker-entrypoint.sh" "${version}/" done for version in "${versions[@]}"; do - if [ "${version}" = "template.Debian" ]; then continue; fi # If update.sh is run without arguments, the template directory is included in the list debianVariant="${debianVariants[$version]:-$defaultDebianVariant}" debianSuite="${debianVariant%%-*}" # "stretch", etc From a8aa1cfed6d5058f64a01ca06cccb1ee3522cd51 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 22 Aug 2018 09:53:37 +0200 Subject: [PATCH 077/285] Template: Create logging functions Logging is done by calling _note, _warn or _error with the message string. _warn and _error print to stderr, and _error causes the script to exit with return code 1 --- .template.Debian/docker-entrypoint.sh | 67 ++++++++++++++------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 86e0398cc..7792f4e7f 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -2,6 +2,22 @@ set -eo pipefail shopt -s nullglob +# logging functions +_log() { + local type=$1;shift + printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" +} +_note() { + _log Note "$@" +} +_warn() { + _log Warn "$@" >&2 +} +_error() { + _log ERROR "$@" >&2 + exit 1 +} + # if command starts with an option, prepend mysqld if [ "${1:0:1}" = '-' ]; then set -- mysqld "$@" @@ -27,8 +43,7 @@ file_env() { local fileVar="${var}_FILE" local def="${2:-}" if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - echo >&2 "$(date --rfc-3339=seconds) [ERROR] [Entrypoint]: Both $var and $fileVar are set (but are exclusive)" - exit 1 + _error "Both $var and $fileVar are set (but are exclusive)" fi local val="$def" if [ "${!var:-}" ]; then @@ -50,10 +65,10 @@ process_init_file() { local mysql=( "$@" ) case "$f" in - *.sh) echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: $0: running $f"; . "$f" ;; - *.sql) echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: $0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: $0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: $0: ignoring $f" ;; + *.sh) _note "$0: running $f"; . "$f" ;; + *.sql) _note "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; + *.sql.gz) _note "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; + *) _warn "$0: ignoring $f" ;; esac echo } @@ -61,15 +76,7 @@ process_init_file() { _check_config() { toRun=( "$@" --verbose --help ) if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - datestring=$(date --rfc-3339=seconds) - cat >&2 <<-EOM - - $datestring [ERROR] [Entrypoint]: mysqld failed while attempting to check config - command was: "${toRun[*]}" - - $errors - EOM - exit 1 + _error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" fi } @@ -97,8 +104,7 @@ _start_server() { sleep 1 done if [ "$i" = 0 ]; then - echo >&2 "$(date --rfc-3339=seconds) [ERROR] [Entrypoint]: Unable to start server." - exit 1 + _error "Unable to start server." fi return $pid } @@ -113,8 +119,7 @@ _stop_server() { fi done # The server hasn't shut down in a timely manner - echo "$(date --rfc-3339=seconds) [ERROR] [Entrypoint]: Unable to shut down server with process id $server_pid" >&2 - return 1 + _error "Unable to shut down server with process id $server_pid" } # allow the container to be started with `--user` @@ -135,28 +140,26 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then if [ ! -d "$DATADIR/mysql" ]; then file_env 'MYSQL_ROOT_PASSWORD' if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - echo >&2 "$(date --rfc-3339=seconds) [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified " - echo >&2 "$(date --rfc-3339=seconds) [ERROR] [Entrypoint]: You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" - exit 1 + _error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" fi mkdir -p "$DATADIR" - echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Initializing database" + _note "Initializing database" "$@" --initialize-insecure - echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Database initialized" + _note "Database initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Initializing certificates" + _note "Initializing certificates" mysql_ssl_rsa_setup --datadir="$DATADIR" - echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Certificates initialized" + _note "Certificates initialized" fi SOCKET="$(_get_config 'socket' "$@")" - echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Starting server" + _note "Starting server" _start_server "${SOCKET}" "$@" || pid=$? - echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Server started with pid $pid" + _note "Server started with pid $pid" mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) @@ -167,7 +170,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" - echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" + _note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi rootCreate= @@ -226,11 +229,11 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then ALTER USER 'root'@'%' PASSWORD EXPIRE; EOSQL fi - echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Stopping server" + _note "Stopping server" _stop_server $pid - echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: Server stopped" + _note "Server stopped" echo - echo "$(date --rfc-3339=seconds) [Note] [Entrypoint]: MySQL init process done. Ready for start up." + _note "MySQL init process done. Ready for start up." echo fi fi From ea73775e6aa87c7f5dbf0b35a539a245e189c644 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 6 Sep 2018 10:27:49 +0200 Subject: [PATCH 078/285] Template: Store root password in file Storing the password in a file lets us use defaults-extra-file option so we don't put it on the command line --- .template.Debian/docker-entrypoint.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 7792f4e7f..78458ba20 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -197,8 +197,16 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then FLUSH PRIVILEGES ; EOSQL + # Store the password in a file so we don't use it on the command line + install -d -m0700 /tmp/mysql-files + PASSFILE=$(mktemp /tmp/mysql-files/XXXXXXXXXX) + install /dev/null -m0600 "${PASSFILE}" if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then - mysql+=( -p"${MYSQL_ROOT_PASSWORD}" ) + cat >"${PASSFILE}" < Date: Thu, 6 Sep 2018 11:07:45 +0200 Subject: [PATCH 079/285] Template: Use mysqladmin to stop temporary server Using a local socket means we don't need to know the pid of the server, and mysqladmin shutdown will block until complete when using a local socket. --- .template.Debian/docker-entrypoint.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 78458ba20..e0e0112cb 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -110,17 +110,13 @@ _start_server() { } _stop_server() { - local server_pid="$1" - kill "$server_pid" - for i in $(seq 1 60); do - sleep 1 - if ! $(pidof /usr/sbin/mysqld >/dev/null 2>&1); then - return 0 - fi - done - # The server hasn't shut down in a timely manner - _error "Unable to shut down server with process id $server_pid" - + local passfile=$1 + local socket=$2 + result=0 + mysqladmin --defaults-extra-file="${passfile}" shutdown -uroot --socket="${socket}" || result=$? + if [ ! "$result" = "0" ]; then + _error "Unable to shut down server. Status code $result." + fi } # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then @@ -238,7 +234,7 @@ EOF EOSQL fi _note "Stopping server" - _stop_server $pid + _stop_server "${PASSFILE}" "${SOCKET}" _note "Server stopped" rm -f "${PASSFILE}" unset PASSFILE From a9e85760c7b18590f5044061cd7da90061c96533 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 6 Sep 2018 11:55:16 +0200 Subject: [PATCH 080/285] Template: Use --daemonize for temporary server startup. When using --daemonize, the server process will fork and exit when the server is ready for use, removing the need for a wait loop. Note: This is only supported for 5.7+ --- .template.Debian/docker-entrypoint.sh | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index e0e0112cb..1fe2d4ef3 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -92,21 +92,11 @@ _get_config() { _start_server() { local socket=$1; shift - "$@" --skip-networking --socket="${socket}" & - local pid="$!" - - mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${socket}" ) - - for i in {30..0}; do - if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then - break - fi - sleep 1 - done - if [ "$i" = 0 ]; then - _error "Unable to start server." + result=0 + "$@" --daemonize --skip-networking --socket="${socket}" || result=$? + if [ ! "$result" = "0" ];then + _error "Unable to start server. Status code $result." fi - return $pid } _stop_server() { @@ -154,8 +144,8 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then SOCKET="$(_get_config 'socket' "$@")" _note "Starting server" - _start_server "${SOCKET}" "$@" || pid=$? - _note "Server started with pid $pid" + _start_server "${SOCKET}" "$@" + _note "Server started with." mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) From 03bdbade047e50342758046b1defb6311cd01c6c Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 13 Sep 2018 09:49:19 +0200 Subject: [PATCH 081/285] Add 5.5 and 5.6 to entrypoint templating This requires adding some variables that are replaced when generating the entrypoint scripts --- .template.Debian/docker-entrypoint.sh | 37 +++++++++++++++++++++------ update.sh | 23 +++++++++++++++-- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 1fe2d4ef3..efdc88820 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -93,12 +93,25 @@ _get_config() { _start_server() { local socket=$1; shift result=0 - "$@" --daemonize --skip-networking --socket="${socket}" || result=$? + %%SERVERSTARTUP%% if [ ! "$result" = "0" ];then _error "Unable to start server. Status code $result." fi } +_wait_for_server() { + local mysql=( "$@" ) + for i in {30..0}; do + if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then + break + fi + sleep 1 + done + if [ "$i" = 0 ]; then + _error "Unable to start server." + fi +} + _stop_server() { local passfile=$1 local socket=$2 @@ -132,7 +145,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then mkdir -p "$DATADIR" _note "Initializing database" - "$@" --initialize-insecure + %%DATABASEINIT%% _note "Database initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then @@ -143,11 +156,15 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then fi SOCKET="$(_get_config 'socket' "$@")" + mysql=( mysql --no-defaults --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) _note "Starting server" _start_server "${SOCKET}" "$@" - _note "Server started with." + if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then + _note "Waiting for server startup" + _wait_for_server "${mysql[@]}" + fi + _note "Server started." - mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then # sed is for https://bugs.mysql.com/bug.php?id=20545 @@ -176,7 +193,7 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; - ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + %%PASSWORDSET%% GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; ${rootCreate} DROP DATABASE IF EXISTS test ; @@ -219,9 +236,13 @@ EOF done if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - "${mysql[@]}" <<-EOSQL - ALTER USER 'root'@'%' PASSWORD EXPIRE; - EOSQL + if [ "${MYSQL_MAJOR}" = "5.5" ]; then + _warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" + else + "${mysql[@]}" <<-EOSQL + ALTER USER 'root'@'%' PASSWORD EXPIRE; + EOSQL + fi fi _note "Stopping server" _stop_server "${PASSFILE}" "${SOCKET}" diff --git a/update.sh b/update.sh index 41dfec7cb..78be6d40d 100755 --- a/update.sh +++ b/update.sh @@ -14,10 +14,29 @@ declare -A debianVariants=( #[5.5]='jessie' ) -# Copy entrypoint template -templateVersions=( "5.7 8.0" ) +# Templaing +templateVersions=( "5.5 5.6 5.7 8.0" ) +declare -A passwordset +passwordset["5.5"]="SET PASSWORD FOR 'root'@'localhost'=PASSWORD('\${MYSQL_ROOT_PASSWORD}');" +passwordset["5.6"]="SET PASSWORD FOR 'root'@'localhost'=PASSWORD('\${MYSQL_ROOT_PASSWORD}');" +passwordset["5.7"]="ALTER USER 'root'@'localhost' IDENTIFIED BY '\${MYSQL_ROOT_PASSWORD}';" +passwordset["8.0"]="ALTER USER 'root'@'localhost' IDENTIFIED BY '\${MYSQL_ROOT_PASSWORD}';" +declare -A database_init +database_init["5.5"]="mysql_install_db --datadir=\"\$DATADIR\" --rpm --basedir=\/usr\/local\/mysql \"\${@:2}\"" +database_init["5.6"]="mysql_install_db --user=mysql --datadir=\"\$DATADIR\" --rpm --keep-my-cnf" +database_init["5.7"]="\"\$@\" --initialize-insecure" +database_init["8.0"]="\"\$@\" --initialize-insecure" +declare -A server_startup +server_startup["5.5"]="\"\$@\" --skip-networking --basedir=\/usr\/local\/mysql --socket=\"\${socket}\" \&" +server_startup["5.6"]="\"\$@\" --skip-networking --socket=\"\${socket}\" \&" +server_startup["5.7"]="\"\$@\" --daemonize --skip-networking --socket=\"\${socket}\" || result=$?" +server_startup["8.0"]="\"\$@\" --daemonize --skip-networking --socket=\"\${socket}\" || result=$?" for version in ${templateVersions}; do cp ".template.Debian/docker-entrypoint.sh" "${version}/" + sed -e 's/%%PASSWORDSET%%/'"${passwordset["$version"]}"'/g' \ + -e 's/%%DATABASEINIT%%/'"${database_init["$version"]}"'/g' \ + -e 's/%%SERVERSTARTUP%%/'"${server_startup["$version"]}"'/g' \ + .template.Debian/docker-entrypoint.sh > "$version/docker-entrypoint.sh" done for version in "${versions[@]}"; do From 2242976d545619cd506c12309c6d374135f9d512 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 13 Sep 2018 10:08:34 +0200 Subject: [PATCH 082/285] Move flag for password file to when the client command is first defined All options regarding config files must be the first specified, so adding it later doesn't work. Using --defaults-file instead of --defaults-extra-file should also mounted config files from interfering with the connection --- .template.Debian/docker-entrypoint.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index efdc88820..3617f4265 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -156,7 +156,12 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then fi SOCKET="$(_get_config 'socket' "$@")" - mysql=( mysql --no-defaults --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) + # We create a file to store the root password in so we don''t use it on the command line + install -d -m0700 /tmp/mysql-files + PASSFILE=$(mktemp /tmp/mysql-files/XXXXXXXXXX) + install /dev/null -m0600 "${PASSFILE}" + + mysql=( mysql --defaults-file="${PASSFILE}" --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) _note "Starting server" _start_server "${SOCKET}" "$@" if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then @@ -200,16 +205,12 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then FLUSH PRIVILEGES ; EOSQL - # Store the password in a file so we don't use it on the command line - install -d -m0700 /tmp/mysql-files - PASSFILE=$(mktemp /tmp/mysql-files/XXXXXXXXXX) - install /dev/null -m0600 "${PASSFILE}" + # Write the password to the file the client uses if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then cat >"${PASSFILE}" < Date: Thu, 20 Sep 2018 10:14:41 +0200 Subject: [PATCH 083/285] Fix typo templaing->templating --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 78be6d40d..d3deac7e8 100755 --- a/update.sh +++ b/update.sh @@ -14,7 +14,7 @@ declare -A debianVariants=( #[5.5]='jessie' ) -# Templaing +# Templating templateVersions=( "5.5 5.6 5.7 8.0" ) declare -A passwordset passwordset["5.5"]="SET PASSWORD FOR 'root'@'localhost'=PASSWORD('\${MYSQL_ROOT_PASSWORD}');" From 4672559853c86e29f5387ea261bd7104c6811e6b Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Fri, 21 Sep 2018 11:51:21 +0200 Subject: [PATCH 084/285] Prefix function names in entrypoint with "docker" This is to reduce risk of collisions with any custom scripts users may attach --- .template.Debian/docker-entrypoint.sh | 106 +++++++++++++------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 3617f4265..5e6aacc74 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -3,18 +3,18 @@ set -eo pipefail shopt -s nullglob # logging functions -_log() { +docker_log() { local type=$1;shift printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" } -_note() { - _log Note "$@" +docker_note() { + docker_log Note "$@" } -_warn() { - _log Warn "$@" >&2 +docker_warn() { + docker_log Warn "$@" >&2 } -_error() { - _log ERROR "$@" >&2 +docker_error() { + docker_log ERROR "$@" >&2 exit 1 } @@ -34,16 +34,16 @@ for arg; do esac done -# usage: file_env VAR [DEFAULT] -# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# usage: docker_file_env VAR [DEFAULT] +# ie: docker_file_env 'XYZ_DB_PASSWORD' 'example' # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) -file_env() { +docker_file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - _error "Both $var and $fileVar are set (but are exclusive)" + docker_error "Both $var and $fileVar are set (but are exclusive)" fi local val="$def" if [ "${!var:-}" ]; then @@ -55,51 +55,51 @@ file_env() { unset "$fileVar" } -# usage: process_init_file FILENAME MYSQLCOMMAND... -# ie: process_init_file foo.sh mysql -uroot +# usage: docker_process_init_file FILENAME MYSQLCOMMAND... +# ie: docker_process_init_file foo.sh mysql -uroot # (process a single initializer file, based on its extension. we define this # function here, so that initializer scripts (*.sh) can use the same logic, # potentially recursively, or override the logic used in subsequent calls) -process_init_file() { +docker_process_init_file() { local f="$1"; shift local mysql=( "$@" ) case "$f" in - *.sh) _note "$0: running $f"; . "$f" ;; - *.sql) _note "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) _note "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) _warn "$0: ignoring $f" ;; + *.sh) docker_note "$0: running $f"; . "$f" ;; + *.sql) docker_note "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; + *.sql.gz) docker_note "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; + *) docker_warn "$0: ignoring $f" ;; esac echo } -_check_config() { +docker_check_config() { toRun=( "$@" --verbose --help ) if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - _error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" + docker_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" fi } # Fetch value from server config # We use mysqld --verbose --help instead of my_print_defaults because the # latter only show values present in config files, and not server defaults -_get_config() { +docker_get_config() { local conf="$1"; shift "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ | awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } -_start_server() { +docker_start_server() { local socket=$1; shift result=0 %%SERVERSTARTUP%% if [ ! "$result" = "0" ];then - _error "Unable to start server. Status code $result." + docker_error "Unable to start server. Status code $result." fi } -_wait_for_server() { +docker_wait_for_server() { local mysql=( "$@" ) for i in {30..0}; do if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then @@ -108,23 +108,23 @@ _wait_for_server() { sleep 1 done if [ "$i" = 0 ]; then - _error "Unable to start server." + docker_error "Unable to start server." fi } -_stop_server() { +docker_stop_server() { local passfile=$1 local socket=$2 result=0 mysqladmin --defaults-extra-file="${passfile}" shutdown -uroot --socket="${socket}" || result=$? if [ ! "$result" = "0" ]; then - _error "Unable to shut down server. Status code $result." + docker_error "Unable to shut down server. Status code $result." fi } # allow the container to be started with `--user` if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then - _check_config "$@" - DATADIR="$(_get_config 'datadir' "$@")" + docker_check_config "$@" + DATADIR="$(docker_get_config 'datadir' "$@")" mkdir -p "$DATADIR" chown -R mysql:mysql "$DATADIR" exec gosu mysql "$BASH_SOURCE" "$@" @@ -132,43 +132,43 @@ fi if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then # still need to check config, container may have started with --user - _check_config "$@" + docker_check_config "$@" # Get config - DATADIR="$(_get_config 'datadir' "$@")" + DATADIR="$(docker_get_config 'datadir' "$@")" if [ ! -d "$DATADIR/mysql" ]; then - file_env 'MYSQL_ROOT_PASSWORD' + docker_file_env 'MYSQL_ROOT_PASSWORD' if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - _error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" + docker_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" fi mkdir -p "$DATADIR" - _note "Initializing database" + docker_note "Initializing database" %%DATABASEINIT%% - _note "Database initialized" + docker_note "Database initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - _note "Initializing certificates" + docker_note "Initializing certificates" mysql_ssl_rsa_setup --datadir="$DATADIR" - _note "Certificates initialized" + docker_note "Certificates initialized" fi - SOCKET="$(_get_config 'socket' "$@")" + SOCKET="$(docker_get_config 'socket' "$@")" # We create a file to store the root password in so we don''t use it on the command line install -d -m0700 /tmp/mysql-files PASSFILE=$(mktemp /tmp/mysql-files/XXXXXXXXXX) install /dev/null -m0600 "${PASSFILE}" mysql=( mysql --defaults-file="${PASSFILE}" --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) - _note "Starting server" - _start_server "${SOCKET}" "$@" + docker_note "Starting server" + docker_start_server "${SOCKET}" "$@" if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then - _note "Waiting for server startup" - _wait_for_server "${mysql[@]}" + docker_note "Waiting for server startup" + docker_wait_for_server "${mysql[@]}" fi - _note "Server started." + docker_note "Server started." if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then @@ -178,12 +178,12 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" - _note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" + docker_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi rootCreate= # default root to listen for connections from anywhere - file_env 'MYSQL_ROOT_HOST' '%' + docker_file_env 'MYSQL_ROOT_HOST' '%' if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then # no, we don't care if read finds a terminating character in this heredoc # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 @@ -213,14 +213,14 @@ password="${MYSQL_ROOT_PASSWORD}" EOF fi - file_env 'MYSQL_DATABASE' + docker_file_env 'MYSQL_DATABASE' if [ "$MYSQL_DATABASE" ]; then echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}" mysql+=( "$MYSQL_DATABASE" ) fi - file_env 'MYSQL_USER' - file_env 'MYSQL_PASSWORD' + docker_file_env 'MYSQL_USER' + docker_file_env 'MYSQL_PASSWORD' if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}" @@ -233,7 +233,7 @@ EOF echo for f in /docker-entrypoint-initdb.d/*; do - process_init_file "$f" "${mysql[@]}" + docker_process_init_file "$f" "${mysql[@]}" done if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then @@ -245,13 +245,13 @@ EOF EOSQL fi fi - _note "Stopping server" - _stop_server "${PASSFILE}" "${SOCKET}" - _note "Server stopped" + docker_note "Stopping server" + docker_stop_server "${PASSFILE}" "${SOCKET}" + docker_note "Server stopped" rm -f "${PASSFILE}" unset PASSFILE echo - _note "MySQL init process done. Ready for start up." + docker_note "MySQL init process done. Ready for start up." echo fi fi From db1271315f1fdb93bc43bbd17c602a8ba124d551 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 18 Oct 2018 07:43:56 +0200 Subject: [PATCH 085/285] entrypoint: Use mktemp instead of install mktemp -d already creates a directory with mode 700, so the install command to ensure it is redundant The same applies to the temporary password file inside this directory. --- .template.Debian/docker-entrypoint.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 5e6aacc74..5ba91bc96 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -157,9 +157,8 @@ if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then SOCKET="$(docker_get_config 'socket' "$@")" # We create a file to store the root password in so we don''t use it on the command line - install -d -m0700 /tmp/mysql-files - PASSFILE=$(mktemp /tmp/mysql-files/XXXXXXXXXX) - install /dev/null -m0600 "${PASSFILE}" + TMPDIR="$(mktemp -d)" + PASSFILE="$(mktemp ${TMPDIR}/XXXXXXXXXX)" mysql=( mysql --defaults-file="${PASSFILE}" --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) docker_note "Starting server" From f9c185f01e1c9565f26cdfb5b112b1d6fd28ccf7 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 18 Oct 2018 09:46:33 +0200 Subject: [PATCH 086/285] entrypoint: Move more logic into functions Almost all logic in the entrypoint script is now separated into various functions --- .template.Debian/docker-entrypoint.sh | 253 ++++++++++++++++---------- update.sh | 8 +- 2 files changed, 162 insertions(+), 99 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 5ba91bc96..f4d5a5f68 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -90,8 +90,8 @@ docker_get_config() { # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } +# Do a temporary startup of the MySQL server, for init purposes docker_start_server() { - local socket=$1; shift result=0 %%SERVERSTARTUP%% if [ ! "$result" = "0" ];then @@ -99,6 +99,8 @@ docker_start_server() { fi } +# Wait for the temporary server to be ready for connections. +# It is only used for versions older than 5.7 docker_wait_for_server() { local mysql=( "$@" ) for i in {30..0}; do @@ -112,123 +114,188 @@ docker_wait_for_server() { fi } +# Stop the server. When using a local socket file mysqladmin will block until +# the shutdown is complete. docker_stop_server() { - local passfile=$1 - local socket=$2 result=0 - mysqladmin --defaults-extra-file="${passfile}" shutdown -uroot --socket="${socket}" || result=$? + mysqladmin --defaults-extra-file="${PASSFILE}" shutdown -uroot --socket="${SOCKET}" || result=$? if [ ! "$result" = "0" ]; then docker_error "Unable to shut down server. Status code $result." fi } + +# Verify that the minimally required password settings are set for new databases. +docker_verify_env() { + if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + docker_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" + fi +} + +# Creates and initializes the database directory +docker_init_database_dir() { + mkdir -p "$DATADIR" + + docker_note "Initializing database files" + %%DATABASEINIT%% + docker_note "Database files initialized" + + if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then + # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 + docker_note "Initializing certificates" + mysql_ssl_rsa_setup --datadir="$DATADIR" + docker_note "Certificates initialized" + fi +} + +# Loads various settings that are used elsewhere in the script +docker_init_env() { + # Get config + DATADIR="$(docker_get_config 'datadir' "$@")" + SOCKET="$(docker_get_config 'socket' "$@")" + + # We create a file to store the root password in so we don''t use it on the command line + TMPDIR="$(mktemp -d)" + PASSFILE="$(mktemp ${TMPDIR}/XXXXXXXXXX)" + + # Initialize values that might be stored in a file + docker_file_env 'MYSQL_ROOT_HOST' '%' + docker_file_env 'MYSQL_DATABASE' + docker_file_env 'MYSQL_USER' + docker_file_env 'MYSQL_PASSWORD' + docker_file_env 'MYSQL_ROOT_PASSWORD' +} + +# Define the client command that's used in various places +docker_init_client_command() { + mysql=( mysql --defaults-file="${PASSFILE}" --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) +} + +# Store root password in a file for use with the client command +docker_write_password_file() { + # Write the password to the file the client uses + if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then + cat >"${PASSFILE}" < /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then - # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - docker_note "Initializing certificates" - mysql_ssl_rsa_setup --datadir="$DATADIR" - docker_note "Certificates initialized" - fi - - SOCKET="$(docker_get_config 'socket' "$@")" - # We create a file to store the root password in so we don''t use it on the command line - TMPDIR="$(mktemp -d)" - PASSFILE="$(mktemp ${TMPDIR}/XXXXXXXXXX)" + docker_verify_env + docker_init_database_dir "$@" + docker_init_client_command - mysql=( mysql --defaults-file="${PASSFILE}" --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) - docker_note "Starting server" - docker_start_server "${SOCKET}" "$@" + docker_note "Starting temporary server" + docker_start_server "$@" + # For 5.7+ the server is ready for use as soon as startup command unblocks if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then docker_note "Waiting for server startup" docker_wait_for_server "${mysql[@]}" fi - docker_note "Server started." + docker_note "Temporary server started." if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then - # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql + docker_load_tzinfo fi if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" - docker_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" - fi - - rootCreate= - # default root to listen for connections from anywhere - docker_file_env 'MYSQL_ROOT_HOST' '%' - if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then - # no, we don't care if read finds a terminating character in this heredoc - # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 - read -r -d '' rootCreate <<-EOSQL || true - CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ; - EOSQL - fi - - "${mysql[@]}" <<-EOSQL - -- What's done in this file shouldn't be replicated - -- or products like mysql-fabric won't work - SET @@SESSION.SQL_LOG_BIN=0; - - %%PASSWORDSET%% - GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; - ${rootCreate} - DROP DATABASE IF EXISTS test ; - FLUSH PRIVILEGES ; - EOSQL - - # Write the password to the file the client uses - if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then - cat >"${PASSFILE}" < Date: Mon, 22 Oct 2018 08:23:05 +0200 Subject: [PATCH 087/285] entrypoint: Move main script functionality to function Main mysql functionality is now executed from docker_main() Also fixes a bug where script would attempt to load mysql config for non-mysqld commands, which would cause errors --- .template.Debian/docker-entrypoint.sh | 131 +++++++++++++------------- 1 file changed, 68 insertions(+), 63 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index f4d5a5f68..50f6e5189 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -251,71 +251,76 @@ docker_load_tzinfo() { mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql } -docker_init_env "$@" - -# allow the container to be started with `--user` -if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then - docker_check_config "$@" - mkdir -p "$DATADIR" - chown -R mysql:mysql "$DATADIR" - exec gosu mysql "$BASH_SOURCE" "$@" -fi - -docker_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." - -if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then - # still need to check config, container may have started with --user - docker_check_config "$@" - - # If this is true then there's no database, and it needs to be initialized - if [ ! -d "$DATADIR/mysql" ]; then - docker_verify_env - docker_init_database_dir "$@" - docker_init_client_command - - docker_note "Starting temporary server" - docker_start_server "$@" - # For 5.7+ the server is ready for use as soon as startup command unblocks - if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then - docker_note "Waiting for server startup" - docker_wait_for_server "${mysql[@]}" +docker_main() { + docker_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." + + if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then + # Load various environment variables + docker_init_env "$@" + + # If container is started as root user, restart as dedicated mysql user + if [ "$(id -u)" = '0' ]; then + docker_check_config "$@" + mkdir -p "$DATADIR" + chown -R mysql:mysql "$DATADIR" + docker_note "Switching to dedicated user 'mysql'" + exec gosu mysql "$BASH_SOURCE" "$@" fi - docker_note "Temporary server started." - - if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then - docker_load_tzinfo + # still need to check config, container may have started with --user + docker_check_config "$@" + + # If this is true then there's no database, and it needs to be initialized + if [ ! -d "$DATADIR/mysql" ]; then + docker_verify_env + docker_init_database_dir "$@" + docker_init_client_command + + docker_note "Starting temporary server" + docker_start_server "$@" + # For 5.7+ the server is ready for use as soon as startup command unblocks + if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then + docker_note "Waiting for server startup" + docker_wait_for_server "${mysql[@]}" + fi + docker_note "Temporary server started." + + + if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then + docker_load_tzinfo + fi + + if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + docker_generate_root_password + fi + + docker_init_root_user + + docker_write_password_file + + docker_init_database_user + + echo + for f in /docker-entrypoint-initdb.d/*; do + docker_process_init_file "$f" "${mysql[@]}" + done + + if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then + docker_expire_root_user + fi + docker_note "Stopping temporary server" + docker_stop_server + docker_note "Temporary server stopped" + + # Remove the password file now that initialization is complete + rm -f "${PASSFILE}" + unset PASSFILE + echo + docker_note "MySQL init process done. Ready for start up." + echo fi - - if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - docker_generate_root_password - fi - - docker_init_root_user - - docker_write_password_file - - docker_init_database_user - - echo - for f in /docker-entrypoint-initdb.d/*; do - docker_process_init_file "$f" "${mysql[@]}" - done - - if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - docker_expire_root_user - fi - docker_note "Stopping temporary server" - docker_stop_server - docker_note "Temporary server stopped" - - # Remove the password file now that initialization is complete - rm -f "${PASSFILE}" - unset PASSFILE - echo - docker_note "MySQL init process done. Ready for start up." - echo fi -fi + exec "$@" +} -exec "$@" +docker_main "$@" From 33ba3e51ef116a97b33e18864e6e9a41b4e0a0f7 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 5 Nov 2018 11:11:58 +0100 Subject: [PATCH 088/285] entrypoint: Only execute main function if the script is not sourced If entrypoint.sh is sourced from elsewhere we don't execute the main function, so custom entrypoint scripts can use the helper functions directly. --- .template.Debian/docker-entrypoint.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 50f6e5189..7b794ef79 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -322,5 +322,8 @@ docker_main() { fi exec "$@" } - -docker_main "$@" +# This checks if the script has been sourced from elsewhere. +# If so we don't perform any further actions +if [ ! "${FUNCNAME[${#FUNCNAME[@]} - 1]}" = 'source' ]; then + docker_main "$@" +fi From 9f77ea5ad3ac151b4c0c2fb9982e0c4b4a8ede97 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 8 Nov 2018 08:53:26 +0100 Subject: [PATCH 089/285] entrypoint: Make value checks more consistent To compare actual values, some checks used ! variable = value while others used variable != value. Changed all to the latter. --- .template.Debian/docker-entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 7b794ef79..d7f8b7cdd 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -94,7 +94,7 @@ docker_get_config() { docker_start_server() { result=0 %%SERVERSTARTUP%% - if [ ! "$result" = "0" ];then + if [ "$result" != "0" ];then docker_error "Unable to start server. Status code $result." fi } @@ -119,7 +119,7 @@ docker_wait_for_server() { docker_stop_server() { result=0 mysqladmin --defaults-extra-file="${PASSFILE}" shutdown -uroot --socket="${SOCKET}" || result=$? - if [ ! "$result" = "0" ]; then + if [ "$result" != "0" ]; then docker_error "Unable to shut down server. Status code $result." fi } @@ -324,6 +324,6 @@ docker_main() { } # This checks if the script has been sourced from elsewhere. # If so we don't perform any further actions -if [ ! "${FUNCNAME[${#FUNCNAME[@]} - 1]}" = 'source' ]; then +if [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" != 'source' ]; then docker_main "$@" fi From ef9caa95ec42ffa6c5fcd5cd884b67cca0ae8b38 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 1 Apr 2019 10:37:09 +0200 Subject: [PATCH 090/285] Rename docker_check_config to mysql_check_config This function is mysql-only --- .template.Debian/docker-entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index d7f8b7cdd..30adbfd6c 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -73,7 +73,7 @@ docker_process_init_file() { echo } -docker_check_config() { +mysql_check_config() { toRun=( "$@" --verbose --help ) if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then docker_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" @@ -260,7 +260,7 @@ docker_main() { # If container is started as root user, restart as dedicated mysql user if [ "$(id -u)" = '0' ]; then - docker_check_config "$@" + mysql_check_config "$@" mkdir -p "$DATADIR" chown -R mysql:mysql "$DATADIR" docker_note "Switching to dedicated user 'mysql'" @@ -268,7 +268,7 @@ docker_main() { fi # still need to check config, container may have started with --user - docker_check_config "$@" + mysql_check_config "$@" # If this is true then there's no database, and it needs to be initialized if [ ! -d "$DATADIR/mysql" ]; then From 2fcb086490233ff9e1b156d7296f54dba4b821e8 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 1 Apr 2019 10:37:49 +0200 Subject: [PATCH 091/285] Rename docker_file_env to file_env This function is not meant to be part of the public set --- .template.Debian/docker-entrypoint.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 30adbfd6c..f087af868 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -34,11 +34,11 @@ for arg; do esac done -# usage: docker_file_env VAR [DEFAULT] -# ie: docker_file_env 'XYZ_DB_PASSWORD' 'example' +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of # "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) -docker_file_env() { +file_env() { local var="$1" local fileVar="${var}_FILE" local def="${2:-}" @@ -158,11 +158,11 @@ docker_init_env() { PASSFILE="$(mktemp ${TMPDIR}/XXXXXXXXXX)" # Initialize values that might be stored in a file - docker_file_env 'MYSQL_ROOT_HOST' '%' - docker_file_env 'MYSQL_DATABASE' - docker_file_env 'MYSQL_USER' - docker_file_env 'MYSQL_PASSWORD' - docker_file_env 'MYSQL_ROOT_PASSWORD' + file_env 'MYSQL_ROOT_HOST' '%' + file_env 'MYSQL_DATABASE' + file_env 'MYSQL_USER' + file_env 'MYSQL_PASSWORD' + file_env 'MYSQL_ROOT_PASSWORD' } # Define the client command that's used in various places From 1503220c4b22c6f9bcba1ca27c95f86e6b1d7723 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 1 Apr 2019 10:39:23 +0200 Subject: [PATCH 092/285] Rename docker_verify_env to docker_verify_minimum_env --- .template.Debian/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index f087af868..c15e9a563 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -125,7 +125,7 @@ docker_stop_server() { } # Verify that the minimally required password settings are set for new databases. -docker_verify_env() { +docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then docker_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" fi @@ -272,7 +272,7 @@ docker_main() { # If this is true then there's no database, and it needs to be initialized if [ ! -d "$DATADIR/mysql" ]; then - docker_verify_env + docker_verify_minimum_env docker_init_database_dir "$@" docker_init_client_command From 67f2bd3e099ade5bd2ca1c55d49be7bf1b9e17f6 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 1 Apr 2019 10:40:09 +0200 Subject: [PATCH 093/285] Rename docker_process_init_file to docker_process_init_files --- .template.Debian/docker-entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index c15e9a563..11be41de9 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -55,12 +55,12 @@ file_env() { unset "$fileVar" } -# usage: docker_process_init_file FILENAME MYSQLCOMMAND... -# ie: docker_process_init_file foo.sh mysql -uroot +# usage: docker_process_init_files FILENAME MYSQLCOMMAND... +# ie: docker_process_init_files foo.sh mysql -uroot # (process a single initializer file, based on its extension. we define this # function here, so that initializer scripts (*.sh) can use the same logic, # potentially recursively, or override the logic used in subsequent calls) -docker_process_init_file() { +docker_process_init_files() { local f="$1"; shift local mysql=( "$@" ) @@ -302,7 +302,7 @@ docker_main() { echo for f in /docker-entrypoint-initdb.d/*; do - docker_process_init_file "$f" "${mysql[@]}" + docker_process_init_files "$f" "${mysql[@]}" done if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then From 5e10737f52e4b919581bbcc0bec8aee4cb5ce040 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 1 Apr 2019 11:05:12 +0200 Subject: [PATCH 094/285] Rename docker_write_password_file to mysql_write_password_file This function is MySQL-only --- .template.Debian/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 11be41de9..af4e11c2b 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -171,7 +171,7 @@ docker_init_client_command() { } # Store root password in a file for use with the client command -docker_write_password_file() { +mysql_write_password_file() { # Write the password to the file the client uses if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then cat >"${PASSFILE}" < Date: Thu, 4 Apr 2019 12:18:29 +0200 Subject: [PATCH 095/285] Rename docker_get_config to mysql_get_config This function is mysql-only --- .template.Debian/docker-entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index af4e11c2b..a81307b23 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -83,7 +83,7 @@ mysql_check_config() { # Fetch value from server config # We use mysqld --verbose --help instead of my_print_defaults because the # latter only show values present in config files, and not server defaults -docker_get_config() { +mysql_get_config() { local conf="$1"; shift "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ | awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' @@ -150,8 +150,8 @@ docker_init_database_dir() { # Loads various settings that are used elsewhere in the script docker_init_env() { # Get config - DATADIR="$(docker_get_config 'datadir' "$@")" - SOCKET="$(docker_get_config 'socket' "$@")" + DATADIR="$(mysql_get_config 'datadir' "$@")" + SOCKET="$(mysql_get_config 'socket' "$@")" # We create a file to store the root password in so we don''t use it on the command line TMPDIR="$(mktemp -d)" From 34ae313bd9d0f0d6152593c2a7f3bc59ec27d6c2 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 4 Apr 2019 12:19:19 +0200 Subject: [PATCH 096/285] Rename docker_init_env to docker_setup_env --- .template.Debian/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index a81307b23..369d4fb58 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -148,7 +148,7 @@ docker_init_database_dir() { } # Loads various settings that are used elsewhere in the script -docker_init_env() { +docker_setup_env() { # Get config DATADIR="$(mysql_get_config 'datadir' "$@")" SOCKET="$(mysql_get_config 'socket' "$@")" @@ -256,7 +256,7 @@ docker_main() { if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then # Load various environment variables - docker_init_env "$@" + docker_setup_env "$@" # If container is started as root user, restart as dedicated mysql user if [ "$(id -u)" = '0' ]; then From c9600d299c974d9b9588abc59da2944609ec95d3 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 4 Apr 2019 12:33:45 +0200 Subject: [PATCH 097/285] Rename log functions from docker to mysql --- .template.Debian/docker-entrypoint.sh | 66 +++++++++++++-------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 369d4fb58..bbe5fd1ca 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -3,18 +3,18 @@ set -eo pipefail shopt -s nullglob # logging functions -docker_log() { +mysql_log() { local type=$1;shift printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" } -docker_note() { - docker_log Note "$@" +mysql_note() { + mysql_log Note "$@" } -docker_warn() { - docker_log Warn "$@" >&2 +mysql_warn() { + mysql_log Warn "$@" >&2 } -docker_error() { - docker_log ERROR "$@" >&2 +mysql_error() { + mysql_log ERROR "$@" >&2 exit 1 } @@ -43,7 +43,7 @@ file_env() { local fileVar="${var}_FILE" local def="${2:-}" if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - docker_error "Both $var and $fileVar are set (but are exclusive)" + mysql_error "Both $var and $fileVar are set (but are exclusive)" fi local val="$def" if [ "${!var:-}" ]; then @@ -65,10 +65,10 @@ docker_process_init_files() { local mysql=( "$@" ) case "$f" in - *.sh) docker_note "$0: running $f"; . "$f" ;; - *.sql) docker_note "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) docker_note "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) docker_warn "$0: ignoring $f" ;; + *.sh) mysql_note "$0: running $f"; . "$f" ;; + *.sql) mysql_note "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; + *) mysql_warn "$0: ignoring $f" ;; esac echo } @@ -76,7 +76,7 @@ docker_process_init_files() { mysql_check_config() { toRun=( "$@" --verbose --help ) if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - docker_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" + mysql_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" fi } @@ -95,7 +95,7 @@ docker_start_server() { result=0 %%SERVERSTARTUP%% if [ "$result" != "0" ];then - docker_error "Unable to start server. Status code $result." + mysql_error "Unable to start server. Status code $result." fi } @@ -110,7 +110,7 @@ docker_wait_for_server() { sleep 1 done if [ "$i" = 0 ]; then - docker_error "Unable to start server." + mysql_error "Unable to start server." fi } @@ -120,14 +120,14 @@ docker_stop_server() { result=0 mysqladmin --defaults-extra-file="${PASSFILE}" shutdown -uroot --socket="${SOCKET}" || result=$? if [ "$result" != "0" ]; then - docker_error "Unable to shut down server. Status code $result." + mysql_error "Unable to shut down server. Status code $result." fi } # Verify that the minimally required password settings are set for new databases. docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - docker_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" + mysql_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" fi } @@ -135,15 +135,15 @@ docker_verify_minimum_env() { docker_init_database_dir() { mkdir -p "$DATADIR" - docker_note "Initializing database files" + mysql_note "Initializing database files" %%DATABASEINIT%% - docker_note "Database files initialized" + mysql_note "Database files initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - docker_note "Initializing certificates" + mysql_note "Initializing certificates" mysql_ssl_rsa_setup --datadir="$DATADIR" - docker_note "Certificates initialized" + mysql_note "Certificates initialized" fi } @@ -210,13 +210,13 @@ docker_init_root_user() { # Creates a custom database and user if specified docker_init_database_user() { if [ "$MYSQL_DATABASE" ]; then - docker_note "Creating database ${MYSQL_DATABASE}" + mysql_note "Creating database ${MYSQL_DATABASE}" echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}" mysql+=( "$MYSQL_DATABASE" ) fi if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then - docker_note "Creating user ${MYSQL_USER}" + mysql_note "Creating user ${MYSQL_USER}" echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}" if [ "$MYSQL_DATABASE" ]; then @@ -231,7 +231,7 @@ docker_init_database_user() { # else can be done (only supported for 5.6+) docker_expire_root_user() { if [ "${MYSQL_MAJOR}" = "5.5" ]; then - _warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" + mysql_warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" else "${mysql[@]}" <<-EOSQL ALTER USER 'root'@'%' PASSWORD EXPIRE; @@ -242,7 +242,7 @@ docker_expire_root_user() { # Generate a random root password docker_generate_root_password() { export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" - docker_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" + mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" } # Load timezone info into database @@ -252,7 +252,7 @@ docker_load_tzinfo() { } docker_main() { - docker_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." + mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then # Load various environment variables @@ -263,7 +263,7 @@ docker_main() { mysql_check_config "$@" mkdir -p "$DATADIR" chown -R mysql:mysql "$DATADIR" - docker_note "Switching to dedicated user 'mysql'" + mysql_note "Switching to dedicated user 'mysql'" exec gosu mysql "$BASH_SOURCE" "$@" fi @@ -276,14 +276,14 @@ docker_main() { docker_init_database_dir "$@" docker_init_client_command - docker_note "Starting temporary server" + mysql_note "Starting temporary server" docker_start_server "$@" # For 5.7+ the server is ready for use as soon as startup command unblocks if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then - docker_note "Waiting for server startup" + mysql_note "Waiting for server startup" docker_wait_for_server "${mysql[@]}" fi - docker_note "Temporary server started." + mysql_note "Temporary server started." if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then @@ -308,15 +308,15 @@ docker_main() { if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then docker_expire_root_user fi - docker_note "Stopping temporary server" + mysql_note "Stopping temporary server" docker_stop_server - docker_note "Temporary server stopped" + mysql_note "Temporary server stopped" # Remove the password file now that initialization is complete rm -f "${PASSFILE}" unset PASSFILE echo - docker_note "MySQL init process done. Ready for start up." + mysql_note "MySQL init process done. Ready for start up." echo fi fi From f1abc95f9aa5671f0a54674140aa7da4ad8487a1 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 4 Apr 2019 12:34:25 +0200 Subject: [PATCH 098/285] Rename docker_main to _main The function is not meant to be overridden --- .template.Debian/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index bbe5fd1ca..f04ae6ff2 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -251,7 +251,7 @@ docker_load_tzinfo() { mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql } -docker_main() { +_main() { mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then @@ -325,5 +325,5 @@ docker_main() { # This checks if the script has been sourced from elsewhere. # If so we don't perform any further actions if [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" != 'source' ]; then - docker_main "$@" + _main "$@" fi From 915c79228f2bd6db1d7a413ec745cb5e3722c251 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 4 Apr 2019 12:35:34 +0200 Subject: [PATCH 099/285] Rename functions for starting and stopping server --- .template.Debian/docker-entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index f04ae6ff2..c3645c0aa 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -91,7 +91,7 @@ mysql_get_config() { } # Do a temporary startup of the MySQL server, for init purposes -docker_start_server() { +docker_temp_server_start() { result=0 %%SERVERSTARTUP%% if [ "$result" != "0" ];then @@ -116,7 +116,7 @@ docker_wait_for_server() { # Stop the server. When using a local socket file mysqladmin will block until # the shutdown is complete. -docker_stop_server() { +docker_temp_server_stop() { result=0 mysqladmin --defaults-extra-file="${PASSFILE}" shutdown -uroot --socket="${SOCKET}" || result=$? if [ "$result" != "0" ]; then @@ -277,7 +277,7 @@ _main() { docker_init_client_command mysql_note "Starting temporary server" - docker_start_server "$@" + docker_temp_server_start "$@" # For 5.7+ the server is ready for use as soon as startup command unblocks if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then mysql_note "Waiting for server startup" @@ -309,7 +309,7 @@ _main() { docker_expire_root_user fi mysql_note "Stopping temporary server" - docker_stop_server + docker_temp_server_stop mysql_note "Temporary server stopped" # Remove the password file now that initialization is complete From 9b90b1c6fdbacdc2e9661fd87babf25f49608d55 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 4 Apr 2019 12:38:12 +0200 Subject: [PATCH 100/285] Move old-mysql-only logic for waiting for server startup into function --- .template.Debian/docker-entrypoint.sh | 29 +++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index c3645c0aa..424f1e0ed 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -97,21 +97,25 @@ docker_temp_server_start() { if [ "$result" != "0" ];then mysql_error "Unable to start server. Status code $result." fi + + # For 5.7+ the server is ready for use as soon as startup command unblocks + if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then + mysql_note "Waiting for server startup" + for i in {30..0}; do + if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then + break + fi + sleep 1 + done + if [ "$i" = 0 ]; then + mysql_error "Unable to start server." + fi + fi } # Wait for the temporary server to be ready for connections. # It is only used for versions older than 5.7 docker_wait_for_server() { - local mysql=( "$@" ) - for i in {30..0}; do - if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then - break - fi - sleep 1 - done - if [ "$i" = 0 ]; then - mysql_error "Unable to start server." - fi } # Stop the server. When using a local socket file mysqladmin will block until @@ -278,11 +282,6 @@ _main() { mysql_note "Starting temporary server" docker_temp_server_start "$@" - # For 5.7+ the server is ready for use as soon as startup command unblocks - if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then - mysql_note "Waiting for server startup" - docker_wait_for_server "${mysql[@]}" - fi mysql_note "Temporary server started." From dfa4cb4c99ec9fbc4efeb2582a6522741d3201bb Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Thu, 4 Apr 2019 12:49:52 +0200 Subject: [PATCH 101/285] Rename docker_expire_root_user to mysql_expire_root_user The function is mysql-only --- .template.Debian/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 424f1e0ed..6a6bf037e 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -233,7 +233,7 @@ docker_init_database_user() { # Mark root user as expired so the password must be changed before anything # else can be done (only supported for 5.6+) -docker_expire_root_user() { +mysql_expire_root_user() { if [ "${MYSQL_MAJOR}" = "5.5" ]; then mysql_warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" else @@ -305,7 +305,7 @@ _main() { done if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - docker_expire_root_user + mysql_expire_root_user fi mysql_note "Stopping temporary server" docker_temp_server_stop From 880bb34fe5d5972ca948d88a65168dcb6a5ad6b5 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 8 May 2019 07:40:42 +0200 Subject: [PATCH 102/285] Rename docker_init_database_user to docker_setup_db_users --- .template.Debian/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 6a6bf037e..084a7b4f5 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -212,7 +212,7 @@ docker_init_root_user() { } # Creates a custom database and user if specified -docker_init_database_user() { +docker_setup_db_users() { if [ "$MYSQL_DATABASE" ]; then mysql_note "Creating database ${MYSQL_DATABASE}" echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}" @@ -297,7 +297,7 @@ _main() { mysql_write_password_file - docker_init_database_user + docker_setup_db_users echo for f in /docker-entrypoint-initdb.d/*; do From 04b03e069f9a46c0798871605f7b4254c46b8e0c Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 8 May 2019 08:17:51 +0200 Subject: [PATCH 103/285] Merge functions mysql_write_password_file, docker_init_root_user and docker_setup_db_users into docker_setup_db --- .template.Debian/docker-entrypoint.sh | 34 ++++++++++----------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 084a7b4f5..f4a87da21 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -174,19 +174,9 @@ docker_init_client_command() { mysql=( mysql --defaults-file="${PASSFILE}" --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) } -# Store root password in a file for use with the client command -mysql_write_password_file() { - # Write the password to the file the client uses - if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then - cat >"${PASSFILE}" <"${PASSFILE}" < Date: Wed, 8 May 2019 08:25:26 +0200 Subject: [PATCH 104/285] Rename function docker_init_database_dir to docker_create_db_directories --- .template.Debian/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index f4a87da21..0775a95e2 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -136,7 +136,7 @@ docker_verify_minimum_env() { } # Creates and initializes the database directory -docker_init_database_dir() { +docker_create_db_directories() { mkdir -p "$DATADIR" mysql_note "Initializing database files" @@ -273,7 +273,7 @@ _main() { # If this is true then there's no database, and it needs to be initialized if [ ! -d "$DATADIR/mysql" ]; then docker_verify_minimum_env - docker_init_database_dir "$@" + docker_create_db_directories "$@" docker_init_client_command mysql_note "Starting temporary server" From ce4d14deff7c0eed988b1041ef98035df7db4687 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 8 May 2019 08:27:37 +0200 Subject: [PATCH 105/285] Merge function docker_generate_root_password into docker_setup_db --- .template.Debian/docker-entrypoint.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 0775a95e2..6ffc75e3b 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -176,6 +176,11 @@ docker_init_client_command() { # Creates initial database users and schema docker_setup_db() { + # Generate random root password + if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" + mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" + fi # Sets root password and creates root users for non-localhost hosts rootCreate= # default root to listen for connections from anywhere @@ -239,12 +244,6 @@ mysql_expire_root_user() { fi } -# Generate a random root password -docker_generate_root_password() { - export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" - mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" -} - # Load timezone info into database docker_load_tzinfo() { # sed is for https://bugs.mysql.com/bug.php?id=20545 @@ -285,10 +284,6 @@ _main() { docker_load_tzinfo fi - if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - docker_generate_root_password - fi - docker_setup_db echo From 964f6c210806242ede6bc64ca0f0bee08e9d6606 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 8 May 2019 08:32:26 +0200 Subject: [PATCH 106/285] Merge function docker_load_tzinfo into docker_setup_db --- .template.Debian/docker-entrypoint.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 6ffc75e3b..489d8c1d7 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -174,8 +174,13 @@ docker_init_client_command() { mysql=( mysql --defaults-file="${PASSFILE}" --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) } -# Creates initial database users and schema +# Initializes database with timezone info and root password, plus optional extra db/user docker_setup_db() { + # Load timezone info into database + if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then + # sed is for https://bugs.mysql.com/bug.php?id=20545 + mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql + fi # Generate random root password if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" @@ -244,12 +249,6 @@ mysql_expire_root_user() { fi } -# Load timezone info into database -docker_load_tzinfo() { - # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql -} - _main() { mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." @@ -280,10 +279,6 @@ _main() { mysql_note "Temporary server started." - if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then - docker_load_tzinfo - fi - docker_setup_db echo From 125ac54bb820e9b474ff39793208456a705e4105 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 8 May 2019 09:34:28 +0200 Subject: [PATCH 107/285] Replace function docker_init_client_command with docker_process_sql Instead of setting a command variable, the new function takes sql scripts as input and executes them. --- .template.Debian/docker-entrypoint.sh | 38 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 489d8c1d7..3004e375b 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -62,12 +62,11 @@ file_env() { # potentially recursively, or override the logic used in subsequent calls) docker_process_init_files() { local f="$1"; shift - local mysql=( "$@" ) case "$f" in *.sh) mysql_note "$0: running $f"; . "$f" ;; - *.sql) mysql_note "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql "$(cat $f)"; echo ;; + *.sql.gz) mysql_note "$0: running $f"; docker_process_sql "$(gunzip -c $f)"; echo ;; *) mysql_warn "$0: ignoring $f" ;; esac echo @@ -102,7 +101,7 @@ docker_temp_server_start() { if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then mysql_note "Waiting for server startup" for i in {30..0}; do - if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then + if docker_process_sql "SELECT 1" &> /dev/null; then break fi sleep 1 @@ -169,6 +168,16 @@ docker_setup_env() { file_env 'MYSQL_ROOT_PASSWORD' } +# Execute sql script +docker_process_sql() { + SQL=$1 + DB=$2 + if [ -z "$SQL" ]; then + mysql_error "Empty sql script provided" + fi + echo "$SQL" | mysql --defaults-file="${PASSFILE}" --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$DB" +} + # Define the client command that's used in various places docker_init_client_command() { mysql=( mysql --defaults-file="${PASSFILE}" --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) @@ -179,7 +188,7 @@ docker_setup_db() { # Load timezone info into database if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql + docker_process_sql "$(mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/')" mysql fi # Generate random root password if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then @@ -198,7 +207,7 @@ docker_setup_db() { EOSQL fi - "${mysql[@]}" <<-EOSQL + docker_process_sql " -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; @@ -208,7 +217,7 @@ docker_setup_db() { ${rootCreate} DROP DATABASE IF EXISTS test ; FLUSH PRIVILEGES ; - EOSQL + " # Write the password to the file the client uses if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then @@ -221,19 +230,20 @@ EOF # Creates a custom database and user if specified if [ "$MYSQL_DATABASE" ]; then mysql_note "Creating database ${MYSQL_DATABASE}" - echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}" + docker_process_sql "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" mysql+=( "$MYSQL_DATABASE" ) fi if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then mysql_note "Creating user ${MYSQL_USER}" - echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}" + docker_process_sql "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" if [ "$MYSQL_DATABASE" ]; then - echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" | "${mysql[@]}" + mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" + docker_process_sql "GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" fi - echo 'FLUSH PRIVILEGES ;' | "${mysql[@]}" + docker_process_sql "FLUSH PRIVILEGES ;" fi } @@ -243,9 +253,7 @@ mysql_expire_root_user() { if [ "${MYSQL_MAJOR}" = "5.5" ]; then mysql_warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" else - "${mysql[@]}" <<-EOSQL - ALTER USER 'root'@'%' PASSWORD EXPIRE; - EOSQL + docker_process_sql "ALTER USER 'root'@'%' PASSWORD EXPIRE;" fi } @@ -283,7 +291,7 @@ _main() { echo for f in /docker-entrypoint-initdb.d/*; do - docker_process_init_files "$f" "${mysql[@]}" + docker_process_init_files "$f" done if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then From bbf5d013e6a7e3852be4c0d857e4a84941afa1ba Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 8 May 2019 09:56:30 +0200 Subject: [PATCH 108/285] Remove empty function docker_wait_for_server --- .template.Debian/docker-entrypoint.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 3004e375b..7607d854e 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -112,11 +112,6 @@ docker_temp_server_start() { fi } -# Wait for the temporary server to be ready for connections. -# It is only used for versions older than 5.7 -docker_wait_for_server() { -} - # Stop the server. When using a local socket file mysqladmin will block until # the shutdown is complete. docker_temp_server_stop() { From 06acf82405f4b264b4f8dd5c127c9891ccc1ffa0 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Thu, 16 May 2019 16:58:37 -0700 Subject: [PATCH 109/285] A few entrypoint updates to increase usability `docker-entrypoint.sh`: - update `docker_process_init_files` to take in a list of file - update `docker_process_sql` to take sql input on stdin to maintain compatibility with `mysql` (and prevent us from loading an entire `.sql` file into memory) - move any code that was outside a function to `_main` or other functions - use `local` variables in functions to limit scope - move current `docker_create_db_directories` logic to `docker_init_database_dir` - new docker_create_db_directories that just creates and chowns directories - move `PASSFILE` to be in memory only so that we don't accidentally not clean it up - move `FLUSH PRIVILEGES` to fix https://github.com/docker-library/mysql/pull/549 update.sh: - add back `DELETE` statement for 5.5 and 5.6 - swap some template strings to single quotes to make it easier to read - swap `sed` to use ! for delimter - use one loop rather than two --- .template.Debian/docker-entrypoint.sh | 192 ++++++++++++++------------ update.sh | 33 ++--- 2 files changed, 117 insertions(+), 108 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 7607d854e..4b92486f7 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -4,7 +4,7 @@ shopt -s nullglob # logging functions mysql_log() { - local type=$1;shift + local type="$1"; shift printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" } mysql_note() { @@ -18,22 +18,6 @@ mysql_error() { exit 1 } -# if command starts with an option, prepend mysqld -if [ "${1:0:1}" = '-' ]; then - set -- mysqld "$@" -fi - -# skip setup if they want an option that stops mysqld -wantHelp= -for arg; do - case "$arg" in - -'?'|--help|--print-defaults|-V|--version) - wantHelp=1 - break - ;; - esac -done - # usage: file_env VAR [DEFAULT] # ie: file_env 'XYZ_DB_PASSWORD' 'example' # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of @@ -55,25 +39,28 @@ file_env() { unset "$fileVar" } -# usage: docker_process_init_files FILENAME MYSQLCOMMAND... -# ie: docker_process_init_files foo.sh mysql -uroot -# (process a single initializer file, based on its extension. we define this -# function here, so that initializer scripts (*.sh) can use the same logic, -# potentially recursively, or override the logic used in subsequent calls) +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions docker_process_init_files() { - local f="$1"; shift - - case "$f" in - *.sh) mysql_note "$0: running $f"; . "$f" ;; - *.sql) mysql_note "$0: running $f"; docker_process_sql "$(cat $f)"; echo ;; - *.sql.gz) mysql_note "$0: running $f"; docker_process_sql "$(gunzip -c $f)"; echo ;; - *) mysql_warn "$0: ignoring $f" ;; - esac + # mysql here for backwards compatibility "${mysql[@]}" + mysql=( docker_process_sql ) + echo + local f + for f; do + case "$f" in + *.sh) mysql_note "$0: running $f"; . "$f" ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *) mysql_warn "$0: ignoring $f" ;; + esac + echo + done } mysql_check_config() { - toRun=( "$@" --verbose --help ) + local toRun=( "$@" --verbose --help ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then mysql_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" fi @@ -85,13 +72,13 @@ mysql_check_config() { mysql_get_config() { local conf="$1"; shift "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ - | awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - result=0 + local result=0 %%SERVERSTARTUP%% if [ "$result" != "0" ];then mysql_error "Unable to start server. Status code $result." @@ -100,8 +87,9 @@ docker_temp_server_start() { # For 5.7+ the server is ready for use as soon as startup command unblocks if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then mysql_note "Waiting for server startup" + local i for i in {30..0}; do - if docker_process_sql "SELECT 1" &> /dev/null; then + if docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then break fi sleep 1 @@ -115,8 +103,8 @@ docker_temp_server_start() { # Stop the server. When using a local socket file mysqladmin will block until # the shutdown is complete. docker_temp_server_stop() { - result=0 - mysqladmin --defaults-extra-file="${PASSFILE}" shutdown -uroot --socket="${SOCKET}" || result=$? + local result=0 + mysqladmin --defaults-extra-file=<( echo "${PASSFILE}" ) shutdown -uroot --socket="${SOCKET}" || result=$? if [ "$result" != "0" ]; then mysql_error "Unable to shut down server. Status code $result." fi @@ -129,10 +117,23 @@ docker_verify_minimum_env() { fi } -# Creates and initializes the database directory +# creates folders for the database +# also ensures permission for user mysql of run as root docker_create_db_directories() { + local user; user="$(id -u)" + + # TODO other directories that are used by default? like /var/lib/mysql-files + # see https://github.com/docker-library/mysql/issues/562 mkdir -p "$DATADIR" + if [ "$user" = "0" ]; then + # this will cause less disk access than `chown -R` + find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + fi +} + +# initializes the database directory +docker_init_database_dir() { mysql_note "Initializing database files" %%DATABASEINIT%% mysql_note "Database files initialized" @@ -150,11 +151,7 @@ docker_setup_env() { # Get config DATADIR="$(mysql_get_config 'datadir' "$@")" SOCKET="$(mysql_get_config 'socket' "$@")" - - # We create a file to store the root password in so we don''t use it on the command line - TMPDIR="$(mktemp -d)" - PASSFILE="$(mktemp ${TMPDIR}/XXXXXXXXXX)" - + # Initialize values that might be stored in a file file_env 'MYSQL_ROOT_HOST' '%' file_env 'MYSQL_DATABASE' @@ -163,19 +160,17 @@ docker_setup_env() { file_env 'MYSQL_ROOT_PASSWORD' } -# Execute sql script +# Execute sql script, passed via stdin +# usage: docker_process_sql [mysql-cli-args] +# ie: docker_process_sql --database=mydb <<<'INSERT ...' +# ie: docker_process_sql --database=mydb "${PASSFILE}" < "$version/docker-entrypoint.sh" -done +server_startup["5.5"]='"$@" --skip-networking --basedir=/usr/local/mysql --socket="${SOCKET}" \&' +server_startup["5.6"]='"$@" --skip-networking --socket="${SOCKET}" \&' +server_startup["5.7"]='"$@" --daemonize --skip-networking --socket="${SOCKET}" || result="$?"' +server_startup["8.0"]='"$@" --daemonize --skip-networking --socket="${SOCKET}" || result="$?"' for version in "${versions[@]}"; do + sed -e 's!%%PASSWORDSET%%!'"${passwordset["$version"]}"'!g' \ + -e 's!%%DATABASEINIT%%!'"${database_init["$version"]}"'!g' \ + -e 's!%%SERVERSTARTUP%%!'"${server_startup["$version"]}"'!g' \ + .template.Debian/docker-entrypoint.sh > "$version/docker-entrypoint.sh" + debianVariant="${debianVariants[$version]:-$defaultDebianVariant}" debianSuite="${debianVariant%%-*}" # "stretch", etc From 169471f8933036e74f80ff45f50db4e5953c8197 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Fri, 24 May 2019 14:52:36 -0700 Subject: [PATCH 110/285] Apply update.sh to update each entrypoint; drop 5.5 from update.sh --- 5.6/docker-entrypoint.sh | 404 ++++++++++++++++++++++++-------------- 5.7/docker-entrypoint.sh | 406 +++++++++++++++++++++++++-------------- 8.0/docker-entrypoint.sh | 406 +++++++++++++++++++++++++-------------- update.sh | 3 - 4 files changed, 774 insertions(+), 445 deletions(-) diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 7dbd6975a..7a47b0161 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -2,21 +2,21 @@ set -eo pipefail shopt -s nullglob -# if command starts with an option, prepend mysqld -if [ "${1:0:1}" = '-' ]; then - set -- mysqld "$@" -fi - -# skip setup if they want an option that stops mysqld -wantHelp= -for arg; do - case "$arg" in - -'?'|--help|--print-defaults|-V|--version) - wantHelp=1 - break - ;; - esac -done +# logging functions +mysql_log() { + local type="$1"; shift + printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" +} +mysql_note() { + mysql_log Note "$@" +} +mysql_warn() { + mysql_log Warn "$@" >&2 +} +mysql_error() { + mysql_log ERROR "$@" >&2 + exit 1 +} # usage: file_env VAR [DEFAULT] # ie: file_env 'XYZ_DB_PASSWORD' 'example' @@ -27,8 +27,7 @@ file_env() { local fileVar="${var}_FILE" local def="${2:-}" if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 + mysql_error "Both $var and $fileVar are set (but are exclusive)" fi local val="$def" if [ "${!var:-}" ]; then @@ -40,171 +39,288 @@ file_env() { unset "$fileVar" } -# usage: process_init_file FILENAME MYSQLCOMMAND... -# ie: process_init_file foo.sh mysql -uroot -# (process a single initializer file, based on its extension. we define this -# function here, so that initializer scripts (*.sh) can use the same logic, -# potentially recursively, or override the logic used in subsequent calls) -process_init_file() { - local f="$1"; shift - local mysql=( "$@" ) - - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) echo "$0: ignoring $f" ;; - esac +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions +docker_process_init_files() { + # mysql here for backwards compatibility "${mysql[@]}" + mysql=( docker_process_sql ) + echo + local f + for f; do + case "$f" in + *.sh) mysql_note "$0: running $f"; . "$f" ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *) mysql_warn "$0: ignoring $f" ;; + esac + echo + done } -_check_config() { - toRun=( "$@" --verbose --help --log-bin-index="$(mktemp -u)" ) +mysql_check_config() { + local toRun=( "$@" --verbose --help ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - cat >&2 <<-EOM - - ERROR: mysqld failed while attempting to check config - command was: "${toRun[*]}" - - $errors - EOM - exit 1 + mysql_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" fi } # Fetch value from server config # We use mysqld --verbose --help instead of my_print_defaults because the # latter only show values present in config files, and not server defaults -_get_config() { +mysql_get_config() { local conf="$1"; shift - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null | awk '$1 == "'"$conf"'" { print $2; exit }' + "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ + | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } -# allow the container to be started with `--user` -if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then - _check_config "$@" - DATADIR="$(_get_config 'datadir' "$@")" - mkdir -p "$DATADIR" - chown -R mysql:mysql "$DATADIR" - exec gosu mysql "$BASH_SOURCE" "$@" -fi - -if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then - # still need to check config, container may have started with --user - _check_config "$@" - # Get config - DATADIR="$(_get_config 'datadir' "$@")" - - if [ ! -d "$DATADIR/mysql" ]; then - file_env 'MYSQL_ROOT_PASSWORD' - if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - echo >&2 'error: database is uninitialized and password option is not specified ' - echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' - exit 1 - fi - - mkdir -p "$DATADIR" - - echo 'Initializing database' - # "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here) - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" - echo 'Database initialized' - - SOCKET="$(_get_config 'socket' "$@")" - "$@" --skip-networking --socket="${SOCKET}" & - pid="$!" - - mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) +# Do a temporary startup of the MySQL server, for init purposes +docker_temp_server_start() { + local result=0 + "$@" --skip-networking --socket="${SOCKET}" & + if [ "$result" != "0" ];then + mysql_error "Unable to start server. Status code $result." + fi + # For 5.7+ the server is ready for use as soon as startup command unblocks + if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then + mysql_note "Waiting for server startup" + local i for i in {30..0}; do - if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then + if docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then break fi - echo 'MySQL init process in progress...' sleep 1 done if [ "$i" = 0 ]; then - echo >&2 'MySQL init process failed.' - exit 1 + mysql_error "Unable to start server." fi + fi +} - if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then - # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql - fi +# Stop the server. When using a local socket file mysqladmin will block until +# the shutdown is complete. +docker_temp_server_stop() { + local result=0 + mysqladmin --defaults-extra-file=<( echo "${PASSFILE}" ) shutdown -uroot --socket="${SOCKET}" || result=$? + if [ "$result" != "0" ]; then + mysql_error "Unable to shut down server. Status code $result." + fi +} - if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" - echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" - fi +# Verify that the minimally required password settings are set for new databases. +docker_verify_minimum_env() { + if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + mysql_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" + fi +} - rootCreate= - # default root to listen for connections from anywhere - file_env 'MYSQL_ROOT_HOST' '%' - if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then - # no, we don't care if read finds a terminating character in this heredoc - # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 - read -r -d '' rootCreate <<-EOSQL || true - CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ; - EOSQL - fi +# creates folders for the database +# also ensures permission for user mysql of run as root +docker_create_db_directories() { + local user; user="$(id -u)" + + # TODO other directories that are used by default? like /var/lib/mysql-files + # see https://github.com/docker-library/mysql/issues/562 + mkdir -p "$DATADIR" - "${mysql[@]}" <<-EOSQL - -- What's done in this file shouldn't be replicated - -- or products like mysql-fabric won't work - SET @@SESSION.SQL_LOG_BIN=0; - - DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; - SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; - GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; - ${rootCreate} - DROP DATABASE IF EXISTS test ; - FLUSH PRIVILEGES ; + if [ "$user" = "0" ]; then + # this will cause less disk access than `chown -R` + find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + fi +} + +# initializes the database directory +docker_init_database_dir() { + mysql_note "Initializing database files" + mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" + mysql_note "Database files initialized" + + if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then + # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 + mysql_note "Initializing certificates" + mysql_ssl_rsa_setup --datadir="$DATADIR" + mysql_note "Certificates initialized" + fi +} + +# Loads various settings that are used elsewhere in the script +docker_setup_env() { + # Get config + DATADIR="$(mysql_get_config 'datadir' "$@")" + SOCKET="$(mysql_get_config 'socket' "$@")" + + # Initialize values that might be stored in a file + file_env 'MYSQL_ROOT_HOST' '%' + file_env 'MYSQL_DATABASE' + file_env 'MYSQL_USER' + file_env 'MYSQL_PASSWORD' + file_env 'MYSQL_ROOT_PASSWORD' +} + +# Execute sql script, passed via stdin +# usage: docker_process_sql [mysql-cli-args] +# ie: docker_process_sql --database=mydb <<<'INSERT ...' +# ie: docker_process_sql --database=mydb /dev/null - for f in /docker-entrypoint-initdb.d/*; do - process_init_file "$f" "${mysql[@]}" - done + docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" + fi +} - if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - "${mysql[@]}" <<-EOSQL +# Mark root user as expired so the password must be changed before anything +# else can be done (only supported for 5.6+) +mysql_expire_root_user() { + if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then + if [ "${MYSQL_MAJOR}" = "5.5" ]; then + mysql_warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" + else + docker_process_sql --database=mysql <<-EOSQL ALTER USER 'root'@'%' PASSWORD EXPIRE; EOSQL fi - if ! kill -s TERM "$pid" || ! wait "$pid"; then - echo >&2 'MySQL init process failed.' - exit 1 + fi +} + +# check arguments for an option that would cause mysqld to stop +# return true if there is one +_want_help() { + local arg + for arg; do + case "$arg" in + -'?'|--help|--print-defaults|-V|--version) + return 0 + ;; + esac + done + return 1 +} + +_main() { + # if command starts with an option, prepend mysqld + if [ "${1:0:1}" = '-' ]; then + set -- mysqld "$@" + fi + + # skip setup if they aren't running mysqld or want an option that stops mysqld + if [ "$1" = 'mysqld' ] && ! _want_help "$@"; then + mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." + + # Load various environment variables + docker_setup_env "$@" + mysql_check_config "$@" + + # If container is started as root user, restart as dedicated mysql user + if [ "$(id -u)" = "0" ]; then + docker_create_db_directories + mysql_note "Switching to dedicated user 'mysql'" + exec gosu mysql "$BASH_SOURCE" "$@" fi - echo - echo 'MySQL init process done. Ready for start up.' - echo + # just in case the script was not started as root + docker_create_db_directories + + # If this is true then there's no database, and it needs to be initialized + if [ ! -d "$DATADIR/mysql" ]; then + docker_verify_minimum_env + docker_init_database_dir "$@" + + mysql_note "Starting temporary server" + docker_temp_server_start "$@" + mysql_note "Temporary server started." + + docker_setup_db + docker_process_init_files /docker-entrypoint-initdb.d/* + + mysql_expire_root_user + + mysql_note "Stopping temporary server" + docker_temp_server_stop + mysql_note "Temporary server stopped" + + unset PASSFILE + echo + mysql_note "MySQL init process done. Ready for start up." + echo + fi fi -fi + exec "$@" +} -exec "$@" +# This checks if the script has been sourced from elsewhere. +# If so we don't perform any further actions +# https://unix.stackexchange.com/a/215279 +if [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" != 'source' ]; then + _main "$@" +fi diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 720ef6d65..0bbab715a 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -2,21 +2,21 @@ set -eo pipefail shopt -s nullglob -# if command starts with an option, prepend mysqld -if [ "${1:0:1}" = '-' ]; then - set -- mysqld "$@" -fi - -# skip setup if they want an option that stops mysqld -wantHelp= -for arg; do - case "$arg" in - -'?'|--help|--print-defaults|-V|--version) - wantHelp=1 - break - ;; - esac -done +# logging functions +mysql_log() { + local type="$1"; shift + printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" +} +mysql_note() { + mysql_log Note "$@" +} +mysql_warn() { + mysql_log Warn "$@" >&2 +} +mysql_error() { + mysql_log ERROR "$@" >&2 + exit 1 +} # usage: file_env VAR [DEFAULT] # ie: file_env 'XYZ_DB_PASSWORD' 'example' @@ -27,8 +27,7 @@ file_env() { local fileVar="${var}_FILE" local def="${2:-}" if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 + mysql_error "Both $var and $fileVar are set (but are exclusive)" fi local val="$def" if [ "${!var:-}" ]; then @@ -40,178 +39,287 @@ file_env() { unset "$fileVar" } -# usage: process_init_file FILENAME MYSQLCOMMAND... -# ie: process_init_file foo.sh mysql -uroot -# (process a single initializer file, based on its extension. we define this -# function here, so that initializer scripts (*.sh) can use the same logic, -# potentially recursively, or override the logic used in subsequent calls) -process_init_file() { - local f="$1"; shift - local mysql=( "$@" ) - - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) echo "$0: ignoring $f" ;; - esac +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions +docker_process_init_files() { + # mysql here for backwards compatibility "${mysql[@]}" + mysql=( docker_process_sql ) + echo + local f + for f; do + case "$f" in + *.sh) mysql_note "$0: running $f"; . "$f" ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *) mysql_warn "$0: ignoring $f" ;; + esac + echo + done } -_check_config() { - toRun=( "$@" --verbose --help ) +mysql_check_config() { + local toRun=( "$@" --verbose --help ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - cat >&2 <<-EOM - - ERROR: mysqld failed while attempting to check config - command was: "${toRun[*]}" - - $errors - EOM - exit 1 + mysql_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" fi } # Fetch value from server config # We use mysqld --verbose --help instead of my_print_defaults because the # latter only show values present in config files, and not server defaults -_get_config() { +mysql_get_config() { local conf="$1"; shift "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ - | awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } -# allow the container to be started with `--user` -if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then - _check_config "$@" - DATADIR="$(_get_config 'datadir' "$@")" - mkdir -p "$DATADIR" - chown -R mysql:mysql "$DATADIR" - exec gosu mysql "$BASH_SOURCE" "$@" -fi - -if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then - # still need to check config, container may have started with --user - _check_config "$@" - # Get config - DATADIR="$(_get_config 'datadir' "$@")" - - if [ ! -d "$DATADIR/mysql" ]; then - file_env 'MYSQL_ROOT_PASSWORD' - if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - echo >&2 'error: database is uninitialized and password option is not specified ' - echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' - exit 1 - fi - - mkdir -p "$DATADIR" - - echo 'Initializing database' - "$@" --initialize-insecure - echo 'Database initialized' - - if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then - # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - echo 'Initializing certificates' - mysql_ssl_rsa_setup --datadir="$DATADIR" - echo 'Certificates initialized' - fi - - SOCKET="$(_get_config 'socket' "$@")" - "$@" --skip-networking --socket="${SOCKET}" & - pid="$!" - - mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) +# Do a temporary startup of the MySQL server, for init purposes +docker_temp_server_start() { + local result=0 + "$@" --daemonize --skip-networking --socket="${SOCKET}" || result="$?" + if [ "$result" != "0" ];then + mysql_error "Unable to start server. Status code $result." + fi + # For 5.7+ the server is ready for use as soon as startup command unblocks + if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then + mysql_note "Waiting for server startup" + local i for i in {30..0}; do - if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then + if docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then break fi - echo 'MySQL init process in progress...' sleep 1 done if [ "$i" = 0 ]; then - echo >&2 'MySQL init process failed.' - exit 1 + mysql_error "Unable to start server." fi + fi +} - if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then - # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql - fi +# Stop the server. When using a local socket file mysqladmin will block until +# the shutdown is complete. +docker_temp_server_stop() { + local result=0 + mysqladmin --defaults-extra-file=<( echo "${PASSFILE}" ) shutdown -uroot --socket="${SOCKET}" || result=$? + if [ "$result" != "0" ]; then + mysql_error "Unable to shut down server. Status code $result." + fi +} - if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" - echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" - fi +# Verify that the minimally required password settings are set for new databases. +docker_verify_minimum_env() { + if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + mysql_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" + fi +} - rootCreate= - # default root to listen for connections from anywhere - file_env 'MYSQL_ROOT_HOST' '%' - if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then - # no, we don't care if read finds a terminating character in this heredoc - # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 - read -r -d '' rootCreate <<-EOSQL || true - CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ; - EOSQL - fi +# creates folders for the database +# also ensures permission for user mysql of run as root +docker_create_db_directories() { + local user; user="$(id -u)" - "${mysql[@]}" <<-EOSQL - -- What's done in this file shouldn't be replicated - -- or products like mysql-fabric won't work - SET @@SESSION.SQL_LOG_BIN=0; + # TODO other directories that are used by default? like /var/lib/mysql-files + # see https://github.com/docker-library/mysql/issues/562 + mkdir -p "$DATADIR" - ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; - ${rootCreate} - DROP DATABASE IF EXISTS test ; - FLUSH PRIVILEGES ; - EOSQL + if [ "$user" = "0" ]; then + # this will cause less disk access than `chown -R` + find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + fi +} - if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then - mysql+=( -p"${MYSQL_ROOT_PASSWORD}" ) - fi +# initializes the database directory +docker_init_database_dir() { + mysql_note "Initializing database files" + "$@" --initialize-insecure + mysql_note "Database files initialized" + + if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then + # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 + mysql_note "Initializing certificates" + mysql_ssl_rsa_setup --datadir="$DATADIR" + mysql_note "Certificates initialized" + fi +} - file_env 'MYSQL_DATABASE' - if [ "$MYSQL_DATABASE" ]; then - echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}" - mysql+=( "$MYSQL_DATABASE" ) - fi +# Loads various settings that are used elsewhere in the script +docker_setup_env() { + # Get config + DATADIR="$(mysql_get_config 'datadir' "$@")" + SOCKET="$(mysql_get_config 'socket' "$@")" + + # Initialize values that might be stored in a file + file_env 'MYSQL_ROOT_HOST' '%' + file_env 'MYSQL_DATABASE' + file_env 'MYSQL_USER' + file_env 'MYSQL_PASSWORD' + file_env 'MYSQL_ROOT_PASSWORD' +} - file_env 'MYSQL_USER' - file_env 'MYSQL_PASSWORD' - if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then - echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}" +# Execute sql script, passed via stdin +# usage: docker_process_sql [mysql-cli-args] +# ie: docker_process_sql --database=mydb <<<'INSERT ...' +# ie: docker_process_sql --database=mydb /dev/null - for f in /docker-entrypoint-initdb.d/*; do - process_init_file "$f" "${mysql[@]}" - done + docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" + fi +} - if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - "${mysql[@]}" <<-EOSQL +# Mark root user as expired so the password must be changed before anything +# else can be done (only supported for 5.6+) +mysql_expire_root_user() { + if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then + if [ "${MYSQL_MAJOR}" = "5.5" ]; then + mysql_warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" + else + docker_process_sql --database=mysql <<-EOSQL ALTER USER 'root'@'%' PASSWORD EXPIRE; EOSQL fi - if ! kill -s TERM "$pid" || ! wait "$pid"; then - echo >&2 'MySQL init process failed.' - exit 1 + fi +} + +# check arguments for an option that would cause mysqld to stop +# return true if there is one +_want_help() { + local arg + for arg; do + case "$arg" in + -'?'|--help|--print-defaults|-V|--version) + return 0 + ;; + esac + done + return 1 +} + +_main() { + # if command starts with an option, prepend mysqld + if [ "${1:0:1}" = '-' ]; then + set -- mysqld "$@" + fi + + # skip setup if they aren't running mysqld or want an option that stops mysqld + if [ "$1" = 'mysqld' ] && ! _want_help "$@"; then + mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." + + # Load various environment variables + docker_setup_env "$@" + mysql_check_config "$@" + + # If container is started as root user, restart as dedicated mysql user + if [ "$(id -u)" = "0" ]; then + docker_create_db_directories + mysql_note "Switching to dedicated user 'mysql'" + exec gosu mysql "$BASH_SOURCE" "$@" fi - echo - echo 'MySQL init process done. Ready for start up.' - echo + # just in case the script was not started as root + docker_create_db_directories + + # If this is true then there's no database, and it needs to be initialized + if [ ! -d "$DATADIR/mysql" ]; then + docker_verify_minimum_env + docker_init_database_dir "$@" + + mysql_note "Starting temporary server" + docker_temp_server_start "$@" + mysql_note "Temporary server started." + + docker_setup_db + docker_process_init_files /docker-entrypoint-initdb.d/* + + mysql_expire_root_user + + mysql_note "Stopping temporary server" + docker_temp_server_stop + mysql_note "Temporary server stopped" + + unset PASSFILE + echo + mysql_note "MySQL init process done. Ready for start up." + echo + fi fi -fi + exec "$@" +} -exec "$@" +# This checks if the script has been sourced from elsewhere. +# If so we don't perform any further actions +# https://unix.stackexchange.com/a/215279 +if [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" != 'source' ]; then + _main "$@" +fi diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 720ef6d65..0bbab715a 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -2,21 +2,21 @@ set -eo pipefail shopt -s nullglob -# if command starts with an option, prepend mysqld -if [ "${1:0:1}" = '-' ]; then - set -- mysqld "$@" -fi - -# skip setup if they want an option that stops mysqld -wantHelp= -for arg; do - case "$arg" in - -'?'|--help|--print-defaults|-V|--version) - wantHelp=1 - break - ;; - esac -done +# logging functions +mysql_log() { + local type="$1"; shift + printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" +} +mysql_note() { + mysql_log Note "$@" +} +mysql_warn() { + mysql_log Warn "$@" >&2 +} +mysql_error() { + mysql_log ERROR "$@" >&2 + exit 1 +} # usage: file_env VAR [DEFAULT] # ie: file_env 'XYZ_DB_PASSWORD' 'example' @@ -27,8 +27,7 @@ file_env() { local fileVar="${var}_FILE" local def="${2:-}" if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - echo >&2 "error: both $var and $fileVar are set (but are exclusive)" - exit 1 + mysql_error "Both $var and $fileVar are set (but are exclusive)" fi local val="$def" if [ "${!var:-}" ]; then @@ -40,178 +39,287 @@ file_env() { unset "$fileVar" } -# usage: process_init_file FILENAME MYSQLCOMMAND... -# ie: process_init_file foo.sh mysql -uroot -# (process a single initializer file, based on its extension. we define this -# function here, so that initializer scripts (*.sh) can use the same logic, -# potentially recursively, or override the logic used in subsequent calls) -process_init_file() { - local f="$1"; shift - local mysql=( "$@" ) - - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; "${mysql[@]}" < "$f"; echo ;; - *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${mysql[@]}"; echo ;; - *) echo "$0: ignoring $f" ;; - esac +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions +docker_process_init_files() { + # mysql here for backwards compatibility "${mysql[@]}" + mysql=( docker_process_sql ) + echo + local f + for f; do + case "$f" in + *.sh) mysql_note "$0: running $f"; . "$f" ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *) mysql_warn "$0: ignoring $f" ;; + esac + echo + done } -_check_config() { - toRun=( "$@" --verbose --help ) +mysql_check_config() { + local toRun=( "$@" --verbose --help ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - cat >&2 <<-EOM - - ERROR: mysqld failed while attempting to check config - command was: "${toRun[*]}" - - $errors - EOM - exit 1 + mysql_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" fi } # Fetch value from server config # We use mysqld --verbose --help instead of my_print_defaults because the # latter only show values present in config files, and not server defaults -_get_config() { +mysql_get_config() { local conf="$1"; shift "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ - | awk '$1 == "'"$conf"'" && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } -# allow the container to be started with `--user` -if [ "$1" = 'mysqld' -a -z "$wantHelp" -a "$(id -u)" = '0' ]; then - _check_config "$@" - DATADIR="$(_get_config 'datadir' "$@")" - mkdir -p "$DATADIR" - chown -R mysql:mysql "$DATADIR" - exec gosu mysql "$BASH_SOURCE" "$@" -fi - -if [ "$1" = 'mysqld' -a -z "$wantHelp" ]; then - # still need to check config, container may have started with --user - _check_config "$@" - # Get config - DATADIR="$(_get_config 'datadir' "$@")" - - if [ ! -d "$DATADIR/mysql" ]; then - file_env 'MYSQL_ROOT_PASSWORD' - if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - echo >&2 'error: database is uninitialized and password option is not specified ' - echo >&2 ' You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' - exit 1 - fi - - mkdir -p "$DATADIR" - - echo 'Initializing database' - "$@" --initialize-insecure - echo 'Database initialized' - - if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then - # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - echo 'Initializing certificates' - mysql_ssl_rsa_setup --datadir="$DATADIR" - echo 'Certificates initialized' - fi - - SOCKET="$(_get_config 'socket' "$@")" - "$@" --skip-networking --socket="${SOCKET}" & - pid="$!" - - mysql=( mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" ) +# Do a temporary startup of the MySQL server, for init purposes +docker_temp_server_start() { + local result=0 + "$@" --daemonize --skip-networking --socket="${SOCKET}" || result="$?" + if [ "$result" != "0" ];then + mysql_error "Unable to start server. Status code $result." + fi + # For 5.7+ the server is ready for use as soon as startup command unblocks + if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then + mysql_note "Waiting for server startup" + local i for i in {30..0}; do - if echo 'SELECT 1' | "${mysql[@]}" &> /dev/null; then + if docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then break fi - echo 'MySQL init process in progress...' sleep 1 done if [ "$i" = 0 ]; then - echo >&2 'MySQL init process failed.' - exit 1 + mysql_error "Unable to start server." fi + fi +} - if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then - # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | "${mysql[@]}" mysql - fi +# Stop the server. When using a local socket file mysqladmin will block until +# the shutdown is complete. +docker_temp_server_stop() { + local result=0 + mysqladmin --defaults-extra-file=<( echo "${PASSFILE}" ) shutdown -uroot --socket="${SOCKET}" || result=$? + if [ "$result" != "0" ]; then + mysql_error "Unable to shut down server. Status code $result." + fi +} - if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" - echo "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" - fi +# Verify that the minimally required password settings are set for new databases. +docker_verify_minimum_env() { + if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + mysql_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" + fi +} - rootCreate= - # default root to listen for connections from anywhere - file_env 'MYSQL_ROOT_HOST' '%' - if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then - # no, we don't care if read finds a terminating character in this heredoc - # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 - read -r -d '' rootCreate <<-EOSQL || true - CREATE USER 'root'@'${MYSQL_ROOT_HOST}' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'${MYSQL_ROOT_HOST}' WITH GRANT OPTION ; - EOSQL - fi +# creates folders for the database +# also ensures permission for user mysql of run as root +docker_create_db_directories() { + local user; user="$(id -u)" - "${mysql[@]}" <<-EOSQL - -- What's done in this file shouldn't be replicated - -- or products like mysql-fabric won't work - SET @@SESSION.SQL_LOG_BIN=0; + # TODO other directories that are used by default? like /var/lib/mysql-files + # see https://github.com/docker-library/mysql/issues/562 + mkdir -p "$DATADIR" - ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION ; - ${rootCreate} - DROP DATABASE IF EXISTS test ; - FLUSH PRIVILEGES ; - EOSQL + if [ "$user" = "0" ]; then + # this will cause less disk access than `chown -R` + find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + fi +} - if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then - mysql+=( -p"${MYSQL_ROOT_PASSWORD}" ) - fi +# initializes the database directory +docker_init_database_dir() { + mysql_note "Initializing database files" + "$@" --initialize-insecure + mysql_note "Database files initialized" + + if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then + # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 + mysql_note "Initializing certificates" + mysql_ssl_rsa_setup --datadir="$DATADIR" + mysql_note "Certificates initialized" + fi +} - file_env 'MYSQL_DATABASE' - if [ "$MYSQL_DATABASE" ]; then - echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" | "${mysql[@]}" - mysql+=( "$MYSQL_DATABASE" ) - fi +# Loads various settings that are used elsewhere in the script +docker_setup_env() { + # Get config + DATADIR="$(mysql_get_config 'datadir' "$@")" + SOCKET="$(mysql_get_config 'socket' "$@")" + + # Initialize values that might be stored in a file + file_env 'MYSQL_ROOT_HOST' '%' + file_env 'MYSQL_DATABASE' + file_env 'MYSQL_USER' + file_env 'MYSQL_PASSWORD' + file_env 'MYSQL_ROOT_PASSWORD' +} - file_env 'MYSQL_USER' - file_env 'MYSQL_PASSWORD' - if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then - echo "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" | "${mysql[@]}" +# Execute sql script, passed via stdin +# usage: docker_process_sql [mysql-cli-args] +# ie: docker_process_sql --database=mydb <<<'INSERT ...' +# ie: docker_process_sql --database=mydb /dev/null - for f in /docker-entrypoint-initdb.d/*; do - process_init_file "$f" "${mysql[@]}" - done + docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" + fi +} - if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - "${mysql[@]}" <<-EOSQL +# Mark root user as expired so the password must be changed before anything +# else can be done (only supported for 5.6+) +mysql_expire_root_user() { + if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then + if [ "${MYSQL_MAJOR}" = "5.5" ]; then + mysql_warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" + else + docker_process_sql --database=mysql <<-EOSQL ALTER USER 'root'@'%' PASSWORD EXPIRE; EOSQL fi - if ! kill -s TERM "$pid" || ! wait "$pid"; then - echo >&2 'MySQL init process failed.' - exit 1 + fi +} + +# check arguments for an option that would cause mysqld to stop +# return true if there is one +_want_help() { + local arg + for arg; do + case "$arg" in + -'?'|--help|--print-defaults|-V|--version) + return 0 + ;; + esac + done + return 1 +} + +_main() { + # if command starts with an option, prepend mysqld + if [ "${1:0:1}" = '-' ]; then + set -- mysqld "$@" + fi + + # skip setup if they aren't running mysqld or want an option that stops mysqld + if [ "$1" = 'mysqld' ] && ! _want_help "$@"; then + mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." + + # Load various environment variables + docker_setup_env "$@" + mysql_check_config "$@" + + # If container is started as root user, restart as dedicated mysql user + if [ "$(id -u)" = "0" ]; then + docker_create_db_directories + mysql_note "Switching to dedicated user 'mysql'" + exec gosu mysql "$BASH_SOURCE" "$@" fi - echo - echo 'MySQL init process done. Ready for start up.' - echo + # just in case the script was not started as root + docker_create_db_directories + + # If this is true then there's no database, and it needs to be initialized + if [ ! -d "$DATADIR/mysql" ]; then + docker_verify_minimum_env + docker_init_database_dir "$@" + + mysql_note "Starting temporary server" + docker_temp_server_start "$@" + mysql_note "Temporary server started." + + docker_setup_db + docker_process_init_files /docker-entrypoint-initdb.d/* + + mysql_expire_root_user + + mysql_note "Stopping temporary server" + docker_temp_server_stop + mysql_note "Temporary server stopped" + + unset PASSFILE + echo + mysql_note "MySQL init process done. Ready for start up." + echo + fi fi -fi + exec "$@" +} -exec "$@" +# This checks if the script has been sourced from elsewhere. +# If so we don't perform any further actions +# https://unix.stackexchange.com/a/215279 +if [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" != 'source' ]; then + _main "$@" +fi diff --git a/update.sh b/update.sh index d7de76e49..e57663ef4 100755 --- a/update.sh +++ b/update.sh @@ -16,17 +16,14 @@ declare -A debianVariants=( # Templating declare -A passwordset -passwordset["5.5"]="DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ;\nSET PASSWORD FOR 'root'@'localhost'=PASSWORD('\${MYSQL_ROOT_PASSWORD}');" passwordset["5.6"]="DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ;\nSET PASSWORD FOR 'root'@'localhost'=PASSWORD('\${MYSQL_ROOT_PASSWORD}');" passwordset["5.7"]="ALTER USER 'root'@'localhost' IDENTIFIED BY '\${MYSQL_ROOT_PASSWORD}';" passwordset["8.0"]="ALTER USER 'root'@'localhost' IDENTIFIED BY '\${MYSQL_ROOT_PASSWORD}';" declare -A database_init -database_init["5.5"]='mysql_install_db --datadir="$DATADIR" --rpm --basedir=/usr/local/mysql "${@:2}"' database_init["5.6"]='mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}"' database_init["5.7"]='"$@" --initialize-insecure' database_init["8.0"]='"$@" --initialize-insecure' declare -A server_startup -server_startup["5.5"]='"$@" --skip-networking --basedir=/usr/local/mysql --socket="${SOCKET}" \&' server_startup["5.6"]='"$@" --skip-networking --socket="${SOCKET}" \&' server_startup["5.7"]='"$@" --daemonize --skip-networking --socket="${SOCKET}" || result="$?"' server_startup["8.0"]='"$@" --daemonize --skip-networking --socket="${SOCKET}" || result="$?"' From 8a58acbab390df5a8f91467db60f5ab247786bcb Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Mon, 3 Jun 2019 16:38:41 -0700 Subject: [PATCH 111/285] Adjustments from tianon's comments - move PASSFILE to a function `_mysql_passfile` - consistently use `-n` over `! -z` or `[ "$var" ]` - drop 5.5 specific blocks - move `docker_create_db_directories` up - rename `_want_help` to `_mysql_want_help` to match new `_mysql_passfile` --- .template.Debian/docker-entrypoint.sh | 74 ++++++++++++++------------- 5.6/docker-entrypoint.sh | 74 ++++++++++++++------------- 5.7/docker-entrypoint.sh | 74 ++++++++++++++------------- 8.0/docker-entrypoint.sh | 74 ++++++++++++++------------- 4 files changed, 152 insertions(+), 144 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 4b92486f7..704e1a1a6 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -85,11 +85,13 @@ docker_temp_server_start() { fi # For 5.7+ the server is ready for use as soon as startup command unblocks - if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then + if [ "${MYSQL_MAJOR}" = "5.6" ]; then mysql_note "Waiting for server startup" local i for i in {30..0}; do - if docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it hasn't been set yet + if MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then break fi sleep 1 @@ -104,7 +106,7 @@ docker_temp_server_start() { # the shutdown is complete. docker_temp_server_stop() { local result=0 - mysqladmin --defaults-extra-file=<( echo "${PASSFILE}" ) shutdown -uroot --socket="${SOCKET}" || result=$? + mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}" || result=$? if [ "$result" != "0" ]; then mysql_error "Unable to shut down server. Status code $result." fi @@ -170,7 +172,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-file=<( echo "${PASSFILE}" ) --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-file=<( _mysql_passfile ) --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" } # Initializes database with timezone info and root password, plus optional extra db/user @@ -178,17 +180,21 @@ docker_setup_db() { # Load timezone info into database if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | docker_process_sql --database=mysql + mysql_tzinfo_to_sql /usr/share/zoneinfo \ + | sed 's/Local time zone must be set--see zic manual page/FCTY/' \ + | MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it hasn't been set yet fi # Generate random root password - if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + if [ -n "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi # Sets root password and creates root users for non-localhost hosts rootCreate= # default root to listen for connections from anywhere - if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then + if [ -n "$MYSQL_ROOT_HOST" ] && [ "$MYSQL_ROOT_HOST" != 'localhost' ]; then # no, we don't care if read finds a terminating character in this heredoc # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 read -r -d '' rootCreate <<-EOSQL || true @@ -197,7 +203,9 @@ docker_setup_db() { EOSQL fi - docker_process_sql --database=mysql <<-EOSQL + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it is just now being set + MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql <<-EOSQL -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; @@ -209,27 +217,17 @@ docker_setup_db() { DROP DATABASE IF EXISTS test ; EOSQL - # Write the password to the "file" the client uses - # the client command will use process substitution to create a file on the fly - # ie: --defaults-file=<( echo "${PASSFILE}" ) - if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then - read -r -d '' PASSFILE <<-EOF || true - [client] - password="${MYSQL_ROOT_PASSWORD}" - EOF - fi - # Creates a custom database and user if specified - if [ "$MYSQL_DATABASE" ]; then + if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Creating database ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" fi - if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then + if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then mysql_note "Creating user ${MYSQL_USER}" docker_process_sql --database=mysql <<<"CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" - if [ "$MYSQL_DATABASE" ]; then + if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" fi @@ -238,23 +236,31 @@ docker_setup_db() { fi } +_mysql_passfile() { + # echo the password to the "file" the client uses + # the client command will use process substitution to create a file on the fly + # ie: --defaults-file=<( _mysql_passfile ) + if [ -n "$MYSQL_ROOT_PASSWORD" ]; then + cat <<-EOF + [client] + password="${MYSQL_ROOT_PASSWORD}" + EOF + fi +} + # Mark root user as expired so the password must be changed before anything # else can be done (only supported for 5.6+) mysql_expire_root_user() { - if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - if [ "${MYSQL_MAJOR}" = "5.5" ]; then - mysql_warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" - else - docker_process_sql --database=mysql <<-EOSQL - ALTER USER 'root'@'%' PASSWORD EXPIRE; - EOSQL - fi + if [ -n "$MYSQL_ONETIME_PASSWORD" ]; then + docker_process_sql --database=mysql <<-EOSQL + ALTER USER 'root'@'%' PASSWORD EXPIRE; + EOSQL fi } # check arguments for an option that would cause mysqld to stop # return true if there is one -_want_help() { +_mysql_want_help() { local arg for arg; do case "$arg" in @@ -273,23 +279,20 @@ _main() { fi # skip setup if they aren't running mysqld or want an option that stops mysqld - if [ "$1" = 'mysqld' ] && ! _want_help "$@"; then + if [ "$1" = 'mysqld' ] && ! _mysql_want_help "$@"; then mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." # Load various environment variables docker_setup_env "$@" mysql_check_config "$@" + docker_create_db_directories # If container is started as root user, restart as dedicated mysql user if [ "$(id -u)" = "0" ]; then - docker_create_db_directories mysql_note "Switching to dedicated user 'mysql'" exec gosu mysql "$BASH_SOURCE" "$@" fi - # just in case the script was not started as root - docker_create_db_directories - # If this is true then there's no database, and it needs to be initialized if [ ! -d "$DATADIR/mysql" ]; then docker_verify_minimum_env @@ -308,7 +311,6 @@ _main() { docker_temp_server_stop mysql_note "Temporary server stopped" - unset PASSFILE echo mysql_note "MySQL init process done. Ready for start up." echo diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 7a47b0161..d4cba6fc4 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -85,11 +85,13 @@ docker_temp_server_start() { fi # For 5.7+ the server is ready for use as soon as startup command unblocks - if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then + if [ "${MYSQL_MAJOR}" = "5.6" ]; then mysql_note "Waiting for server startup" local i for i in {30..0}; do - if docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it hasn't been set yet + if MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then break fi sleep 1 @@ -104,7 +106,7 @@ docker_temp_server_start() { # the shutdown is complete. docker_temp_server_stop() { local result=0 - mysqladmin --defaults-extra-file=<( echo "${PASSFILE}" ) shutdown -uroot --socket="${SOCKET}" || result=$? + mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}" || result=$? if [ "$result" != "0" ]; then mysql_error "Unable to shut down server. Status code $result." fi @@ -170,7 +172,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-file=<( echo "${PASSFILE}" ) --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-file=<( _mysql_passfile ) --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" } # Initializes database with timezone info and root password, plus optional extra db/user @@ -178,17 +180,21 @@ docker_setup_db() { # Load timezone info into database if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | docker_process_sql --database=mysql + mysql_tzinfo_to_sql /usr/share/zoneinfo \ + | sed 's/Local time zone must be set--see zic manual page/FCTY/' \ + | MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it hasn't been set yet fi # Generate random root password - if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + if [ -n "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi # Sets root password and creates root users for non-localhost hosts rootCreate= # default root to listen for connections from anywhere - if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then + if [ -n "$MYSQL_ROOT_HOST" ] && [ "$MYSQL_ROOT_HOST" != 'localhost' ]; then # no, we don't care if read finds a terminating character in this heredoc # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 read -r -d '' rootCreate <<-EOSQL || true @@ -197,7 +203,9 @@ docker_setup_db() { EOSQL fi - docker_process_sql --database=mysql <<-EOSQL + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it is just now being set + MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql <<-EOSQL -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; @@ -210,27 +218,17 @@ SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}'); DROP DATABASE IF EXISTS test ; EOSQL - # Write the password to the "file" the client uses - # the client command will use process substitution to create a file on the fly - # ie: --defaults-file=<( echo "${PASSFILE}" ) - if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then - read -r -d '' PASSFILE <<-EOF || true - [client] - password="${MYSQL_ROOT_PASSWORD}" - EOF - fi - # Creates a custom database and user if specified - if [ "$MYSQL_DATABASE" ]; then + if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Creating database ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" fi - if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then + if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then mysql_note "Creating user ${MYSQL_USER}" docker_process_sql --database=mysql <<<"CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" - if [ "$MYSQL_DATABASE" ]; then + if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" fi @@ -239,23 +237,31 @@ SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}'); fi } +_mysql_passfile() { + # echo the password to the "file" the client uses + # the client command will use process substitution to create a file on the fly + # ie: --defaults-file=<( _mysql_passfile ) + if [ -n "$MYSQL_ROOT_PASSWORD" ]; then + cat <<-EOF + [client] + password="${MYSQL_ROOT_PASSWORD}" + EOF + fi +} + # Mark root user as expired so the password must be changed before anything # else can be done (only supported for 5.6+) mysql_expire_root_user() { - if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - if [ "${MYSQL_MAJOR}" = "5.5" ]; then - mysql_warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" - else - docker_process_sql --database=mysql <<-EOSQL - ALTER USER 'root'@'%' PASSWORD EXPIRE; - EOSQL - fi + if [ -n "$MYSQL_ONETIME_PASSWORD" ]; then + docker_process_sql --database=mysql <<-EOSQL + ALTER USER 'root'@'%' PASSWORD EXPIRE; + EOSQL fi } # check arguments for an option that would cause mysqld to stop # return true if there is one -_want_help() { +_mysql_want_help() { local arg for arg; do case "$arg" in @@ -274,23 +280,20 @@ _main() { fi # skip setup if they aren't running mysqld or want an option that stops mysqld - if [ "$1" = 'mysqld' ] && ! _want_help "$@"; then + if [ "$1" = 'mysqld' ] && ! _mysql_want_help "$@"; then mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." # Load various environment variables docker_setup_env "$@" mysql_check_config "$@" + docker_create_db_directories # If container is started as root user, restart as dedicated mysql user if [ "$(id -u)" = "0" ]; then - docker_create_db_directories mysql_note "Switching to dedicated user 'mysql'" exec gosu mysql "$BASH_SOURCE" "$@" fi - # just in case the script was not started as root - docker_create_db_directories - # If this is true then there's no database, and it needs to be initialized if [ ! -d "$DATADIR/mysql" ]; then docker_verify_minimum_env @@ -309,7 +312,6 @@ _main() { docker_temp_server_stop mysql_note "Temporary server stopped" - unset PASSFILE echo mysql_note "MySQL init process done. Ready for start up." echo diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 0bbab715a..82184a16c 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -85,11 +85,13 @@ docker_temp_server_start() { fi # For 5.7+ the server is ready for use as soon as startup command unblocks - if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then + if [ "${MYSQL_MAJOR}" = "5.6" ]; then mysql_note "Waiting for server startup" local i for i in {30..0}; do - if docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it hasn't been set yet + if MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then break fi sleep 1 @@ -104,7 +106,7 @@ docker_temp_server_start() { # the shutdown is complete. docker_temp_server_stop() { local result=0 - mysqladmin --defaults-extra-file=<( echo "${PASSFILE}" ) shutdown -uroot --socket="${SOCKET}" || result=$? + mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}" || result=$? if [ "$result" != "0" ]; then mysql_error "Unable to shut down server. Status code $result." fi @@ -170,7 +172,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-file=<( echo "${PASSFILE}" ) --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-file=<( _mysql_passfile ) --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" } # Initializes database with timezone info and root password, plus optional extra db/user @@ -178,17 +180,21 @@ docker_setup_db() { # Load timezone info into database if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | docker_process_sql --database=mysql + mysql_tzinfo_to_sql /usr/share/zoneinfo \ + | sed 's/Local time zone must be set--see zic manual page/FCTY/' \ + | MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it hasn't been set yet fi # Generate random root password - if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + if [ -n "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi # Sets root password and creates root users for non-localhost hosts rootCreate= # default root to listen for connections from anywhere - if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then + if [ -n "$MYSQL_ROOT_HOST" ] && [ "$MYSQL_ROOT_HOST" != 'localhost' ]; then # no, we don't care if read finds a terminating character in this heredoc # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 read -r -d '' rootCreate <<-EOSQL || true @@ -197,7 +203,9 @@ docker_setup_db() { EOSQL fi - docker_process_sql --database=mysql <<-EOSQL + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it is just now being set + MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql <<-EOSQL -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; @@ -209,27 +217,17 @@ docker_setup_db() { DROP DATABASE IF EXISTS test ; EOSQL - # Write the password to the "file" the client uses - # the client command will use process substitution to create a file on the fly - # ie: --defaults-file=<( echo "${PASSFILE}" ) - if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then - read -r -d '' PASSFILE <<-EOF || true - [client] - password="${MYSQL_ROOT_PASSWORD}" - EOF - fi - # Creates a custom database and user if specified - if [ "$MYSQL_DATABASE" ]; then + if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Creating database ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" fi - if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then + if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then mysql_note "Creating user ${MYSQL_USER}" docker_process_sql --database=mysql <<<"CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" - if [ "$MYSQL_DATABASE" ]; then + if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" fi @@ -238,23 +236,31 @@ docker_setup_db() { fi } +_mysql_passfile() { + # echo the password to the "file" the client uses + # the client command will use process substitution to create a file on the fly + # ie: --defaults-file=<( _mysql_passfile ) + if [ -n "$MYSQL_ROOT_PASSWORD" ]; then + cat <<-EOF + [client] + password="${MYSQL_ROOT_PASSWORD}" + EOF + fi +} + # Mark root user as expired so the password must be changed before anything # else can be done (only supported for 5.6+) mysql_expire_root_user() { - if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - if [ "${MYSQL_MAJOR}" = "5.5" ]; then - mysql_warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" - else - docker_process_sql --database=mysql <<-EOSQL - ALTER USER 'root'@'%' PASSWORD EXPIRE; - EOSQL - fi + if [ -n "$MYSQL_ONETIME_PASSWORD" ]; then + docker_process_sql --database=mysql <<-EOSQL + ALTER USER 'root'@'%' PASSWORD EXPIRE; + EOSQL fi } # check arguments for an option that would cause mysqld to stop # return true if there is one -_want_help() { +_mysql_want_help() { local arg for arg; do case "$arg" in @@ -273,23 +279,20 @@ _main() { fi # skip setup if they aren't running mysqld or want an option that stops mysqld - if [ "$1" = 'mysqld' ] && ! _want_help "$@"; then + if [ "$1" = 'mysqld' ] && ! _mysql_want_help "$@"; then mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." # Load various environment variables docker_setup_env "$@" mysql_check_config "$@" + docker_create_db_directories # If container is started as root user, restart as dedicated mysql user if [ "$(id -u)" = "0" ]; then - docker_create_db_directories mysql_note "Switching to dedicated user 'mysql'" exec gosu mysql "$BASH_SOURCE" "$@" fi - # just in case the script was not started as root - docker_create_db_directories - # If this is true then there's no database, and it needs to be initialized if [ ! -d "$DATADIR/mysql" ]; then docker_verify_minimum_env @@ -308,7 +311,6 @@ _main() { docker_temp_server_stop mysql_note "Temporary server stopped" - unset PASSFILE echo mysql_note "MySQL init process done. Ready for start up." echo diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 0bbab715a..82184a16c 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -85,11 +85,13 @@ docker_temp_server_start() { fi # For 5.7+ the server is ready for use as soon as startup command unblocks - if [ "${MYSQL_MAJOR}" = "5.5" ] || [ "${MYSQL_MAJOR}" = "5.6" ]; then + if [ "${MYSQL_MAJOR}" = "5.6" ]; then mysql_note "Waiting for server startup" local i for i in {30..0}; do - if docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it hasn't been set yet + if MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then break fi sleep 1 @@ -104,7 +106,7 @@ docker_temp_server_start() { # the shutdown is complete. docker_temp_server_stop() { local result=0 - mysqladmin --defaults-extra-file=<( echo "${PASSFILE}" ) shutdown -uroot --socket="${SOCKET}" || result=$? + mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}" || result=$? if [ "$result" != "0" ]; then mysql_error "Unable to shut down server. Status code $result." fi @@ -170,7 +172,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-file=<( echo "${PASSFILE}" ) --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-file=<( _mysql_passfile ) --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" } # Initializes database with timezone info and root password, plus optional extra db/user @@ -178,17 +180,21 @@ docker_setup_db() { # Load timezone info into database if [ -z "$MYSQL_INITDB_SKIP_TZINFO" ]; then # sed is for https://bugs.mysql.com/bug.php?id=20545 - mysql_tzinfo_to_sql /usr/share/zoneinfo | sed 's/Local time zone must be set--see zic manual page/FCTY/' | docker_process_sql --database=mysql + mysql_tzinfo_to_sql /usr/share/zoneinfo \ + | sed 's/Local time zone must be set--see zic manual page/FCTY/' \ + | MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it hasn't been set yet fi # Generate random root password - if [ ! -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + if [ -n "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi # Sets root password and creates root users for non-localhost hosts rootCreate= # default root to listen for connections from anywhere - if [ ! -z "$MYSQL_ROOT_HOST" -a "$MYSQL_ROOT_HOST" != 'localhost' ]; then + if [ -n "$MYSQL_ROOT_HOST" ] && [ "$MYSQL_ROOT_HOST" != 'localhost' ]; then # no, we don't care if read finds a terminating character in this heredoc # https://unix.stackexchange.com/questions/265149/why-is-set-o-errexit-breaking-this-read-heredoc-expression/265151#265151 read -r -d '' rootCreate <<-EOSQL || true @@ -197,7 +203,9 @@ docker_setup_db() { EOSQL fi - docker_process_sql --database=mysql <<-EOSQL + # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # so that it won't try to fill in a password file when it is just now being set + MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql <<-EOSQL -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; @@ -209,27 +217,17 @@ docker_setup_db() { DROP DATABASE IF EXISTS test ; EOSQL - # Write the password to the "file" the client uses - # the client command will use process substitution to create a file on the fly - # ie: --defaults-file=<( echo "${PASSFILE}" ) - if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then - read -r -d '' PASSFILE <<-EOF || true - [client] - password="${MYSQL_ROOT_PASSWORD}" - EOF - fi - # Creates a custom database and user if specified - if [ "$MYSQL_DATABASE" ]; then + if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Creating database ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` ;" fi - if [ "$MYSQL_USER" -a "$MYSQL_PASSWORD" ]; then + if [ -n "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then mysql_note "Creating user ${MYSQL_USER}" docker_process_sql --database=mysql <<<"CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD' ;" - if [ "$MYSQL_DATABASE" ]; then + if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" fi @@ -238,23 +236,31 @@ docker_setup_db() { fi } +_mysql_passfile() { + # echo the password to the "file" the client uses + # the client command will use process substitution to create a file on the fly + # ie: --defaults-file=<( _mysql_passfile ) + if [ -n "$MYSQL_ROOT_PASSWORD" ]; then + cat <<-EOF + [client] + password="${MYSQL_ROOT_PASSWORD}" + EOF + fi +} + # Mark root user as expired so the password must be changed before anything # else can be done (only supported for 5.6+) mysql_expire_root_user() { - if [ ! -z "$MYSQL_ONETIME_PASSWORD" ]; then - if [ "${MYSQL_MAJOR}" = "5.5" ]; then - mysql_warn "MySQL 5.5 does not support PASSWORD EXPIRE (required for MYSQL_ONETIME_PASSWORD)" - else - docker_process_sql --database=mysql <<-EOSQL - ALTER USER 'root'@'%' PASSWORD EXPIRE; - EOSQL - fi + if [ -n "$MYSQL_ONETIME_PASSWORD" ]; then + docker_process_sql --database=mysql <<-EOSQL + ALTER USER 'root'@'%' PASSWORD EXPIRE; + EOSQL fi } # check arguments for an option that would cause mysqld to stop # return true if there is one -_want_help() { +_mysql_want_help() { local arg for arg; do case "$arg" in @@ -273,23 +279,20 @@ _main() { fi # skip setup if they aren't running mysqld or want an option that stops mysqld - if [ "$1" = 'mysqld' ] && ! _want_help "$@"; then + if [ "$1" = 'mysqld' ] && ! _mysql_want_help "$@"; then mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." # Load various environment variables docker_setup_env "$@" mysql_check_config "$@" + docker_create_db_directories # If container is started as root user, restart as dedicated mysql user if [ "$(id -u)" = "0" ]; then - docker_create_db_directories mysql_note "Switching to dedicated user 'mysql'" exec gosu mysql "$BASH_SOURCE" "$@" fi - # just in case the script was not started as root - docker_create_db_directories - # If this is true then there's no database, and it needs to be initialized if [ ! -d "$DATADIR/mysql" ]; then docker_verify_minimum_env @@ -308,7 +311,6 @@ _main() { docker_temp_server_stop mysql_note "Temporary server stopped" - unset PASSFILE echo mysql_note "MySQL init process done. Ready for start up." echo From 8d01eea76abfde27941fd37b0be6c4e293b058a6 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Fri, 16 Aug 2019 17:07:39 -0700 Subject: [PATCH 112/285] Fix source detection for centos, call check_config first, explicit global for DATADIR SOCKET --- .template.Debian/docker-entrypoint.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 704e1a1a6..c2d37e202 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -39,6 +39,12 @@ file_env() { unset "$fileVar" } +# check to see if this file is being run or sourced from another script +_is_sourced() { + # https://unix.stackexchange.com/a/215279 + [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" == 'source' ] +} + # usage: docker_process_init_files [file [file [...]]] # ie: docker_process_init_files /always-initdb.d/* # process initializer files, based on file extensions @@ -149,8 +155,10 @@ docker_init_database_dir() { } # Loads various settings that are used elsewhere in the script +# This should be called after mysql_check_config, but before any other functions docker_setup_env() { # Get config + declare -g DATADIR SOCKET DATADIR="$(mysql_get_config 'datadir' "$@")" SOCKET="$(mysql_get_config 'socket' "$@")" @@ -282,9 +290,9 @@ _main() { if [ "$1" = 'mysqld' ] && ! _mysql_want_help "$@"; then mysql_note "Entrypoint script for MySQL Server ${MYSQL_VERSION} started." + mysql_check_config "$@" # Load various environment variables docker_setup_env "$@" - mysql_check_config "$@" docker_create_db_directories # If container is started as root user, restart as dedicated mysql user @@ -319,9 +327,7 @@ _main() { exec "$@" } -# This checks if the script has been sourced from elsewhere. -# If so we don't perform any further actions -# https://unix.stackexchange.com/a/215279 -if [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" != 'source' ]; then +# If we are sourced from elsewhere, don't perform any further actions +if ! _is_sourced; then _main "$@" fi From 91785a50c332947c3963018606680acc2608a405 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Tue, 17 Sep 2019 17:05:44 -0700 Subject: [PATCH 113/285] Add --dont-use-mysql-root-password flag for docker_process_sql - also remove bash generating bash --- .template.Debian/docker-entrypoint.sh | 79 +++++++++++++++------- 5.6/docker-entrypoint.sh | 96 ++++++++++++++++++--------- 5.7/docker-entrypoint.sh | 95 +++++++++++++++++--------- 8.0/docker-entrypoint.sh | 95 +++++++++++++++++--------- update.sh | 21 +----- 5 files changed, 251 insertions(+), 135 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index c2d37e202..ed2d88e48 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -84,20 +84,18 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - local result=0 - %%SERVERSTARTUP%% - if [ "$result" != "0" ];then - mysql_error "Unable to start server. Status code $result." - fi - - # For 5.7+ the server is ready for use as soon as startup command unblocks - if [ "${MYSQL_MAJOR}" = "5.6" ]; then + if [ "${MYSQL_MAJOR}" = '5.6' ]; then + "$@" --skip-networking --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i for i in {30..0}; do - # unset MYSQL_ROOT_PASSWORD for just docker_process_sql + # only use the root password if the database has already been initializaed # so that it won't try to fill in a password file when it hasn't been set yet - if MYSQL_ROOT_PASSWORD= docker_process_sql --database=mysql <<<'SELECT 1' &> /dev/null; then + extraArgs=() + if [ -z "$DATABASE_ALREADY_EXISTS" ]; then + extraArgs+=( '--dont-use-mysql-root-password' ) + fi + if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then break fi sleep 1 @@ -105,6 +103,11 @@ docker_temp_server_start() { if [ "$i" = 0 ]; then mysql_error "Unable to start server." fi + else + # For 5.7+ the server is ready for use as soon as startup command unblocks + if ! "$@" --daemonize --skip-networking --socket="${SOCKET}"; then + mysql_error "Unable to start server." + fi fi } @@ -143,7 +146,11 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - %%DATABASEINIT%% + if [ "$MYSQL_MAJOR" = '5.6' ]; then + mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" + else + "$@" --initialize-insecure + fi mysql_note "Database files initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then @@ -168,19 +175,29 @@ docker_setup_env() { file_env 'MYSQL_USER' file_env 'MYSQL_PASSWORD' file_env 'MYSQL_ROOT_PASSWORD' + + declare -g DATABASE_ALREADY_EXISTS + if [ -d "$DATADIR/mysql" ]; then + DATABASE_ALREADY_EXISTS='true' + fi } # Execute sql script, passed via stdin -# usage: docker_process_sql [mysql-cli-args] +# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args] # ie: docker_process_sql --database=mydb <<<'INSERT ...' -# ie: docker_process_sql --database=mydb /dev/null; then + extraArgs=() + if [ -z "$DATABASE_ALREADY_EXISTS" ]; then + extraArgs+=( '--dont-use-mysql-root-password' ) + fi + if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then break fi sleep 1 @@ -99,6 +103,11 @@ docker_temp_server_start() { if [ "$i" = 0 ]; then mysql_error "Unable to start server." fi + else + # For 5.7+ the server is ready for use as soon as startup command unblocks + if ! "$@" --daemonize --skip-networking --socket="${SOCKET}"; then + mysql_error "Unable to start server." + fi fi } @@ -137,7 +146,11 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" + if [ "$MYSQL_MAJOR" = '5.6' ]; then + mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" + else + "$@" --initialize-insecure + fi mysql_note "Database files initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then @@ -149,8 +162,10 @@ docker_init_database_dir() { } # Loads various settings that are used elsewhere in the script +# This should be called after mysql_check_config, but before any other functions docker_setup_env() { # Get config + declare -g DATADIR SOCKET DATADIR="$(mysql_get_config 'datadir' "$@")" SOCKET="$(mysql_get_config 'socket' "$@")" @@ -160,19 +175,29 @@ docker_setup_env() { file_env 'MYSQL_USER' file_env 'MYSQL_PASSWORD' file_env 'MYSQL_ROOT_PASSWORD' + + declare -g DATABASE_ALREADY_EXISTS + if [ -d "$DATADIR/mysql" ]; then + DATABASE_ALREADY_EXISTS='true' + fi } # Execute sql script, passed via stdin -# usage: docker_process_sql [mysql-cli-args] +# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args] # ie: docker_process_sql --database=mydb <<<'INSERT ...' -# ie: docker_process_sql --database=mydb /dev/null; then + extraArgs=() + if [ -z "$DATABASE_ALREADY_EXISTS" ]; then + extraArgs+=( '--dont-use-mysql-root-password' ) + fi + if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then break fi sleep 1 @@ -99,6 +103,11 @@ docker_temp_server_start() { if [ "$i" = 0 ]; then mysql_error "Unable to start server." fi + else + # For 5.7+ the server is ready for use as soon as startup command unblocks + if ! "$@" --daemonize --skip-networking --socket="${SOCKET}"; then + mysql_error "Unable to start server." + fi fi } @@ -137,7 +146,11 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - "$@" --initialize-insecure + if [ "$MYSQL_MAJOR" = '5.6' ]; then + mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" + else + "$@" --initialize-insecure + fi mysql_note "Database files initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then @@ -149,8 +162,10 @@ docker_init_database_dir() { } # Loads various settings that are used elsewhere in the script +# This should be called after mysql_check_config, but before any other functions docker_setup_env() { # Get config + declare -g DATADIR SOCKET DATADIR="$(mysql_get_config 'datadir' "$@")" SOCKET="$(mysql_get_config 'socket' "$@")" @@ -160,19 +175,29 @@ docker_setup_env() { file_env 'MYSQL_USER' file_env 'MYSQL_PASSWORD' file_env 'MYSQL_ROOT_PASSWORD' + + declare -g DATABASE_ALREADY_EXISTS + if [ -d "$DATADIR/mysql" ]; then + DATABASE_ALREADY_EXISTS='true' + fi } # Execute sql script, passed via stdin -# usage: docker_process_sql [mysql-cli-args] +# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args] # ie: docker_process_sql --database=mydb <<<'INSERT ...' -# ie: docker_process_sql --database=mydb /dev/null; then + extraArgs=() + if [ -z "$DATABASE_ALREADY_EXISTS" ]; then + extraArgs+=( '--dont-use-mysql-root-password' ) + fi + if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then break fi sleep 1 @@ -99,6 +103,11 @@ docker_temp_server_start() { if [ "$i" = 0 ]; then mysql_error "Unable to start server." fi + else + # For 5.7+ the server is ready for use as soon as startup command unblocks + if ! "$@" --daemonize --skip-networking --socket="${SOCKET}"; then + mysql_error "Unable to start server." + fi fi } @@ -137,7 +146,11 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - "$@" --initialize-insecure + if [ "$MYSQL_MAJOR" = '5.6' ]; then + mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" + else + "$@" --initialize-insecure + fi mysql_note "Database files initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then @@ -149,8 +162,10 @@ docker_init_database_dir() { } # Loads various settings that are used elsewhere in the script +# This should be called after mysql_check_config, but before any other functions docker_setup_env() { # Get config + declare -g DATADIR SOCKET DATADIR="$(mysql_get_config 'datadir' "$@")" SOCKET="$(mysql_get_config 'socket' "$@")" @@ -160,19 +175,29 @@ docker_setup_env() { file_env 'MYSQL_USER' file_env 'MYSQL_PASSWORD' file_env 'MYSQL_ROOT_PASSWORD' + + declare -g DATABASE_ALREADY_EXISTS + if [ -d "$DATADIR/mysql" ]; then + DATABASE_ALREADY_EXISTS='true' + fi } # Execute sql script, passed via stdin -# usage: docker_process_sql [mysql-cli-args] +# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args] # ie: docker_process_sql --database=mydb <<<'INSERT ...' -# ie: docker_process_sql --database=mydb "$version/docker-entrypoint.sh" - debianVariant="${debianVariants[$version]:-$defaultDebianVariant}" debianSuite="${debianVariant%%-*}" # "stretch", etc + cp -a .template.Debian/docker-entrypoint.sh "$version/docker-entrypoint.sh" + fullVersion="$( curl -fsSL "https://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ | gunzip \ From 206541a450b100a7c665592814e5e882121c5b0a Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Tue, 17 Sep 2019 17:28:31 -0700 Subject: [PATCH 114/285] Adjust printf to be more resilient; use exit code directly instead of a variable --- .template.Debian/docker-entrypoint.sh | 12 +++++------- 5.6/docker-entrypoint.sh | 12 +++++------- 5.7/docker-entrypoint.sh | 12 +++++------- 8.0/docker-entrypoint.sh | 12 +++++------- 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index ed2d88e48..c13f247c5 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -5,7 +5,7 @@ shopt -s nullglob # logging functions mysql_log() { local type="$1"; shift - printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" + printf '%s [%s] [Entrypoint]: %s\n' "$(date --rfc-3339=seconds)" "$type" "$*" } mysql_note() { mysql_log Note "$@" @@ -68,7 +68,7 @@ docker_process_init_files() { mysql_check_config() { local toRun=( "$@" --verbose --help ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - mysql_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" + mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" fi } @@ -114,17 +114,15 @@ docker_temp_server_start() { # Stop the server. When using a local socket file mysqladmin will block until # the shutdown is complete. docker_temp_server_stop() { - local result=0 - mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}" || result=$? - if [ "$result" != "0" ]; then - mysql_error "Unable to shut down server. Status code $result." + if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then + mysql_error "Unable to shut down server." fi } # Verify that the minimally required password settings are set for new databases. docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" + mysql_error $'Database is uninitialized and password option is not specified\n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' fi } diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index ed2d88e48..c13f247c5 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -5,7 +5,7 @@ shopt -s nullglob # logging functions mysql_log() { local type="$1"; shift - printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" + printf '%s [%s] [Entrypoint]: %s\n' "$(date --rfc-3339=seconds)" "$type" "$*" } mysql_note() { mysql_log Note "$@" @@ -68,7 +68,7 @@ docker_process_init_files() { mysql_check_config() { local toRun=( "$@" --verbose --help ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - mysql_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" + mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" fi } @@ -114,17 +114,15 @@ docker_temp_server_start() { # Stop the server. When using a local socket file mysqladmin will block until # the shutdown is complete. docker_temp_server_stop() { - local result=0 - mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}" || result=$? - if [ "$result" != "0" ]; then - mysql_error "Unable to shut down server. Status code $result." + if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then + mysql_error "Unable to shut down server." fi } # Verify that the minimally required password settings are set for new databases. docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" + mysql_error $'Database is uninitialized and password option is not specified\n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' fi } diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index ed2d88e48..c13f247c5 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -5,7 +5,7 @@ shopt -s nullglob # logging functions mysql_log() { local type="$1"; shift - printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" + printf '%s [%s] [Entrypoint]: %s\n' "$(date --rfc-3339=seconds)" "$type" "$*" } mysql_note() { mysql_log Note "$@" @@ -68,7 +68,7 @@ docker_process_init_files() { mysql_check_config() { local toRun=( "$@" --verbose --help ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - mysql_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" + mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" fi } @@ -114,17 +114,15 @@ docker_temp_server_start() { # Stop the server. When using a local socket file mysqladmin will block until # the shutdown is complete. docker_temp_server_stop() { - local result=0 - mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}" || result=$? - if [ "$result" != "0" ]; then - mysql_error "Unable to shut down server. Status code $result." + if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then + mysql_error "Unable to shut down server." fi } # Verify that the minimally required password settings are set for new databases. docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" + mysql_error $'Database is uninitialized and password option is not specified\n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' fi } diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index ed2d88e48..c13f247c5 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -5,7 +5,7 @@ shopt -s nullglob # logging functions mysql_log() { local type="$1"; shift - printf "$(date --rfc-3339=seconds) [${type}] [Entrypoint]: $@\n" + printf '%s [%s] [Entrypoint]: %s\n' "$(date --rfc-3339=seconds)" "$type" "$*" } mysql_note() { mysql_log Note "$@" @@ -68,7 +68,7 @@ docker_process_init_files() { mysql_check_config() { local toRun=( "$@" --verbose --help ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - mysql_error "mysqld failed while attempting to check config\n\tcommand was: ${toRun[*]}\n\t$errors" + mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" fi } @@ -114,17 +114,15 @@ docker_temp_server_start() { # Stop the server. When using a local socket file mysqladmin will block until # the shutdown is complete. docker_temp_server_stop() { - local result=0 - mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}" || result=$? - if [ "$result" != "0" ]; then - mysql_error "Unable to shut down server. Status code $result." + if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then + mysql_error "Unable to shut down server." fi } # Verify that the minimally required password settings are set for new databases. docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error "Database is uninitialized and password option is not specified \n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD" + mysql_error $'Database is uninitialized and password option is not specified\n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' fi } From 06191552d43628d05c590b8ddfdd270d63a0cd3a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 20 Aug 2018 15:46:25 -0700 Subject: [PATCH 115/285] Update "test" database deletion code with extra query from mysql_secure_installation --- .template.Debian/docker-entrypoint.sh | 7 +++++++ 5.6/docker-entrypoint.sh | 7 +++++++ 5.7/docker-entrypoint.sh | 7 +++++++ 8.0/docker-entrypoint.sh | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index c13f247c5..a2d146b85 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -231,6 +231,13 @@ docker_setup_db() { read -r -d '' passwordSet <<-EOSQL || true DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; + + -- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210 + -- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236 + -- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818 + -- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749 + DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ; + -- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6") EOSQL else # no, we don't care if read finds a terminating character in this heredoc (see above) diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index c13f247c5..a2d146b85 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -231,6 +231,13 @@ docker_setup_db() { read -r -d '' passwordSet <<-EOSQL || true DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; + + -- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210 + -- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236 + -- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818 + -- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749 + DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ; + -- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6") EOSQL else # no, we don't care if read finds a terminating character in this heredoc (see above) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index c13f247c5..a2d146b85 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -231,6 +231,13 @@ docker_setup_db() { read -r -d '' passwordSet <<-EOSQL || true DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; + + -- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210 + -- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236 + -- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818 + -- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749 + DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ; + -- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6") EOSQL else # no, we don't care if read finds a terminating character in this heredoc (see above) diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index c13f247c5..a2d146b85 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -231,6 +231,13 @@ docker_setup_db() { read -r -d '' passwordSet <<-EOSQL || true DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; + + -- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210 + -- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236 + -- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818 + -- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749 + DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ; + -- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6") EOSQL else # no, we don't care if read finds a terminating character in this heredoc (see above) From 2501cf38e8fc548e2269f696f70bd19a37d8c97b Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Fri, 11 Oct 2019 13:30:56 -0700 Subject: [PATCH 116/285] Improve _is_sourced check from https://github.com/docker-library/postgres/pull/496/commits/d1cc08935c360ea576943708d8766b33c9b1e1f9 --- .template.Debian/docker-entrypoint.sh | 4 +++- 5.6/docker-entrypoint.sh | 4 +++- 5.7/docker-entrypoint.sh | 4 +++- 8.0/docker-entrypoint.sh | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index a2d146b85..dc6f50ab1 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -42,7 +42,9 @@ file_env() { # check to see if this file is being run or sourced from another script _is_sourced() { # https://unix.stackexchange.com/a/215279 - [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" == 'source' ] + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] } # usage: docker_process_init_files [file [file [...]]] diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index a2d146b85..dc6f50ab1 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -42,7 +42,9 @@ file_env() { # check to see if this file is being run or sourced from another script _is_sourced() { # https://unix.stackexchange.com/a/215279 - [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" == 'source' ] + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] } # usage: docker_process_init_files [file [file [...]]] diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index a2d146b85..dc6f50ab1 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -42,7 +42,9 @@ file_env() { # check to see if this file is being run or sourced from another script _is_sourced() { # https://unix.stackexchange.com/a/215279 - [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" == 'source' ] + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] } # usage: docker_process_init_files [file [file [...]]] diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index a2d146b85..dc6f50ab1 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -42,7 +42,9 @@ file_env() { # check to see if this file is being run or sourced from another script _is_sourced() { # https://unix.stackexchange.com/a/215279 - [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" == 'source' ] + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] } # usage: docker_process_init_files [file [file [...]]] From 367788b4c0eccf8bf6d10e8897262d22cf816284 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 14 Oct 2019 04:15:09 +0000 Subject: [PATCH 117/285] Update to 8.0.18-1debian9 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index c952b9862..bb223d97a 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.17-1debian9 +ENV MYSQL_VERSION 8.0.18-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 49bedb5f999c19d3b931ea8bfd926a5b0a1c1db4 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 14 Oct 2019 04:15:09 +0000 Subject: [PATCH 118/285] Update to 5.6.46-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index ac00a2217..c18aaa28d 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -44,7 +44,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.45-1debian9 +ENV MYSQL_VERSION 5.6.46-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 5fa3526d23a846c6a2982901bc8190025af44336 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 14 Oct 2019 04:15:09 +0000 Subject: [PATCH 119/285] Update to 5.7.28-1debian9 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index b698e6a9e..b29d750eb 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.27-1debian9 +ENV MYSQL_VERSION 5.7.28-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 4efd12788923fae0a00fb6d19c7d07d329fa35d1 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Wed, 16 Oct 2019 16:43:39 +0200 Subject: [PATCH 120/285] Revert to not using daemonize flag for temporary startup of 5.7 server Daemonize lets us avoid a manual wait loop for the server to be ready, but for 5.7 it causes a log redirection error when the image is started with -t, so for now just revert 5.7 image to using the wait loop. --- .template.Debian/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index dc6f50ab1..6f0f1316f 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -86,7 +86,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.6' ]; then + if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then "$@" --skip-networking --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i From 6659750146b7a6b91a96c786729b4d482cf49fe6 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 16 Oct 2019 07:59:19 -0700 Subject: [PATCH 121/285] Apply update.sh --- 5.6/docker-entrypoint.sh | 2 +- 5.7/docker-entrypoint.sh | 2 +- 8.0/docker-entrypoint.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index dc6f50ab1..6f0f1316f 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -86,7 +86,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.6' ]; then + if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then "$@" --skip-networking --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index dc6f50ab1..6f0f1316f 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -86,7 +86,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.6' ]; then + if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then "$@" --skip-networking --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index dc6f50ab1..6f0f1316f 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -86,7 +86,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.6' ]; then + if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then "$@" --skip-networking --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i From 4ee6cf34697d33b2f71144ef55f96867b71220d5 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 12 Jan 2020 23:15:07 +0000 Subject: [PATCH 122/285] Update to 5.6.47-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index c18aaa28d..be6b54c21 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -44,7 +44,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.46-1debian9 +ENV MYSQL_VERSION 5.6.47-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 6952c5d5a9889311157362c528d65dc2e37ff660 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 12 Jan 2020 23:15:07 +0000 Subject: [PATCH 123/285] Update to 5.7.29-1debian9 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index b29d750eb..88edd0629 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.28-1debian9 +ENV MYSQL_VERSION 5.7.29-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 3dfa7a3c038f342b9dec09fa85247bef69ae2349 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 12 Jan 2020 23:15:07 +0000 Subject: [PATCH 124/285] Update to 8.0.19-1debian9 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index bb223d97a..05c01f636 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -46,7 +46,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.18-1debian9 +ENV MYSQL_VERSION 8.0.19-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 335fb9fc8e81da63c0566ed7171820c15ee4e844 Mon Sep 17 00:00:00 2001 From: inductor Date: Sat, 18 Jan 2020 12:01:15 +0900 Subject: [PATCH 125/285] update debian base version to buster --- 5.6/Dockerfile | 6 +++--- 5.7/Dockerfile | 6 +++--- 8.0/Dockerfile | 6 +++--- update.sh | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index be6b54c21..3e9d0a646 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stretch-slim +FROM debian:buster-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql @@ -44,9 +44,9 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.47-1debian9 +ENV MYSQL_VERSION 5.6.47-1debian10 -RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list +RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 88edd0629..46b881e0d 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stretch-slim +FROM debian:buster-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql @@ -46,9 +46,9 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.29-1debian9 +ENV MYSQL_VERSION 5.7.29-1debian10 -RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list +RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 05c01f636..bc8ff23e8 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:stretch-slim +FROM debian:buster-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql @@ -46,9 +46,9 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.19-1debian9 +ENV MYSQL_VERSION 8.0.19-1debian10 -RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list +RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/update.sh b/update.sh index d533c52c6..834600c9c 100755 --- a/update.sh +++ b/update.sh @@ -9,14 +9,14 @@ if [ ${#versions[@]} -eq 0 ]; then fi versions=( "${versions[@]%/}" ) -defaultDebianVariant='stretch-slim' +defaultDebianVariant='buster-slim' declare -A debianVariants=( #[5.5]='jessie' ) for version in "${versions[@]}"; do debianVariant="${debianVariants[$version]:-$defaultDebianVariant}" - debianSuite="${debianVariant%%-*}" # "stretch", etc + debianSuite="${debianVariant%%-*}" # "buster", etc cp -a .template.Debian/docker-entrypoint.sh "$version/docker-entrypoint.sh" From c4d585301408223c27b024ce442b9bcebf0b1855 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Mon, 17 Feb 2020 15:27:40 -0800 Subject: [PATCH 126/285] Add .sql.xz support to docker-entrypoint-initdb.d --- .template.Debian/docker-entrypoint.sh | 1 + 5.6/Dockerfile | 2 ++ 5.6/docker-entrypoint.sh | 1 + 5.7/Dockerfile | 2 ++ 5.7/docker-entrypoint.sh | 1 + 8.0/Dockerfile | 2 ++ 8.0/docker-entrypoint.sh | 1 + 7 files changed, 10 insertions(+) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 6f0f1316f..5a805fd07 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -61,6 +61,7 @@ docker_process_init_files() { *.sh) mysql_note "$0: running $f"; . "$f" ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; *) mysql_warn "$0: ignoring $f" ;; esac echo diff --git a/5.6/Dockerfile b/5.6/Dockerfile index be6b54c21..b5ff1be5d 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -31,6 +31,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Sys::Hostname # Data::Dumper perl \ +# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files + xz-utils \ && rm -rf /var/lib/apt/lists/* RUN set -ex; \ diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 6f0f1316f..5a805fd07 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -61,6 +61,7 @@ docker_process_init_files() { *.sh) mysql_note "$0: running $f"; . "$f" ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; *) mysql_warn "$0: ignoring $f" ;; esac echo diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 88edd0629..714fdd2a2 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -33,6 +33,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Sys::Hostname # Data::Dumper perl \ +# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files + xz-utils \ && rm -rf /var/lib/apt/lists/* RUN set -ex; \ diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 6f0f1316f..5a805fd07 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -61,6 +61,7 @@ docker_process_init_files() { *.sh) mysql_note "$0: running $f"; . "$f" ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; *) mysql_warn "$0: ignoring $f" ;; esac echo diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 05c01f636..e135be89b 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -33,6 +33,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Sys::Hostname # Data::Dumper perl \ +# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files + xz-utils \ && rm -rf /var/lib/apt/lists/* RUN set -ex; \ diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 6f0f1316f..5a805fd07 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -61,6 +61,7 @@ docker_process_init_files() { *.sh) mysql_note "$0: running $f"; . "$f" ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; *) mysql_warn "$0: ignoring $f" ;; esac echo From 69e4645ced5c687b861ce4a4e8aa3ca4600152b6 Mon Sep 17 00:00:00 2001 From: kototoyo Date: Wed, 19 Feb 2020 22:41:09 +0900 Subject: [PATCH 127/285] modify defaults-file -> defaults-extra-file --- .template.Debian/docker-entrypoint.sh | 4 ++-- 5.6/docker-entrypoint.sh | 4 ++-- 5.7/docker-entrypoint.sh | 4 ++-- 8.0/docker-entrypoint.sh | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 5a805fd07..6256a08c0 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -198,7 +198,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" } # Initializes database with timezone info and root password, plus optional extra db/user @@ -284,7 +284,7 @@ docker_setup_db() { _mysql_passfile() { # echo the password to the "file" the client uses # the client command will use process substitution to create a file on the fly - # ie: --defaults-file=<( _mysql_passfile ) + # ie: --defaults-extra-file=<( _mysql_passfile ) if [ '--dont-use-mysql-root-password' != "$1" ] && [ -n "$MYSQL_ROOT_PASSWORD" ]; then cat <<-EOF [client] diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 5a805fd07..6256a08c0 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -198,7 +198,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" } # Initializes database with timezone info and root password, plus optional extra db/user @@ -284,7 +284,7 @@ docker_setup_db() { _mysql_passfile() { # echo the password to the "file" the client uses # the client command will use process substitution to create a file on the fly - # ie: --defaults-file=<( _mysql_passfile ) + # ie: --defaults-extra-file=<( _mysql_passfile ) if [ '--dont-use-mysql-root-password' != "$1" ] && [ -n "$MYSQL_ROOT_PASSWORD" ]; then cat <<-EOF [client] diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 5a805fd07..6256a08c0 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -198,7 +198,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" } # Initializes database with timezone info and root password, plus optional extra db/user @@ -284,7 +284,7 @@ docker_setup_db() { _mysql_passfile() { # echo the password to the "file" the client uses # the client command will use process substitution to create a file on the fly - # ie: --defaults-file=<( _mysql_passfile ) + # ie: --defaults-extra-file=<( _mysql_passfile ) if [ '--dont-use-mysql-root-password' != "$1" ] && [ -n "$MYSQL_ROOT_PASSWORD" ]; then cat <<-EOF [client] diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 5a805fd07..6256a08c0 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -198,7 +198,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" } # Initializes database with timezone info and root password, plus optional extra db/user @@ -284,7 +284,7 @@ docker_setup_db() { _mysql_passfile() { # echo the password to the "file" the client uses # the client command will use process substitution to create a file on the fly - # ie: --defaults-file=<( _mysql_passfile ) + # ie: --defaults-extra-file=<( _mysql_passfile ) if [ '--dont-use-mysql-root-password' != "$1" ] && [ -n "$MYSQL_ROOT_PASSWORD" ]; then cat <<-EOF [client] From 202bf4b2d193b387c091250acbf3b0874a81e49b Mon Sep 17 00:00:00 2001 From: inductor Date: Thu, 27 Feb 2020 12:37:32 +0900 Subject: [PATCH 128/285] update shell --- 5.6/Dockerfile | 6 +++--- update.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 3e9d0a646..be6b54c21 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:buster-slim +FROM debian:stretch-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql @@ -44,9 +44,9 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.47-1debian10 +ENV MYSQL_VERSION 5.6.47-1debian9 -RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list +RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/update.sh b/update.sh index 834600c9c..75a2ecdf2 100755 --- a/update.sh +++ b/update.sh @@ -11,7 +11,7 @@ versions=( "${versions[@]%/}" ) defaultDebianVariant='buster-slim' declare -A debianVariants=( - #[5.5]='jessie' + [5.6]='stretch-slim' ) for version in "${versions[@]}"; do From bc26ed3bb49aaa5f8483dbaf8d47f9e70ab71b5d Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 27 Feb 2020 13:58:03 -0800 Subject: [PATCH 129/285] Restore fix for silently skipped init scripts --- .template.Debian/docker-entrypoint.sh | 4 ++++ 5.6/docker-entrypoint.sh | 4 ++++ 5.7/docker-entrypoint.sh | 4 ++++ 8.0/docker-entrypoint.sh | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 5a805fd07..9b303adca 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -341,6 +341,10 @@ _main() { # there's no database, so it needs to be initialized if [ -z "$DATABASE_ALREADY_EXISTS" ]; then docker_verify_minimum_env + + # check dir permissions to reduce likelihood of half-initialized database + ls /docker-entrypoint-initdb.d/ > /dev/null + docker_init_database_dir "$@" mysql_note "Starting temporary server" diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 5a805fd07..9b303adca 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -341,6 +341,10 @@ _main() { # there's no database, so it needs to be initialized if [ -z "$DATABASE_ALREADY_EXISTS" ]; then docker_verify_minimum_env + + # check dir permissions to reduce likelihood of half-initialized database + ls /docker-entrypoint-initdb.d/ > /dev/null + docker_init_database_dir "$@" mysql_note "Starting temporary server" diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 5a805fd07..9b303adca 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -341,6 +341,10 @@ _main() { # there's no database, so it needs to be initialized if [ -z "$DATABASE_ALREADY_EXISTS" ]; then docker_verify_minimum_env + + # check dir permissions to reduce likelihood of half-initialized database + ls /docker-entrypoint-initdb.d/ > /dev/null + docker_init_database_dir "$@" mysql_note "Starting temporary server" diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 5a805fd07..9b303adca 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -341,6 +341,10 @@ _main() { # there's no database, so it needs to be initialized if [ -z "$DATABASE_ALREADY_EXISTS" ]; then docker_verify_minimum_env + + # check dir permissions to reduce likelihood of half-initialized database + ls /docker-entrypoint-initdb.d/ > /dev/null + docker_init_database_dir "$@" mysql_note "Starting temporary server" From b1c48f6f42aea03d24886e914e98c1c71daa3529 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 10 Apr 2020 15:46:26 -0700 Subject: [PATCH 130/285] Allow "initdb.d" scripts to be executed instead of sourced --- .template.Debian/docker-entrypoint.sh | 12 +++++++++++- 5.6/docker-entrypoint.sh | 12 +++++++++++- 5.7/docker-entrypoint.sh | 12 +++++++++++- 8.0/docker-entrypoint.sh | 12 +++++++++++- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index e7dd7592c..8db356750 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -58,7 +58,17 @@ docker_process_init_files() { local f for f; do case "$f" in - *.sh) mysql_note "$0: running $f"; . "$f" ;; + *.sh) + # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 + # https://github.com/docker-library/postgres/pull/452 + if [ -x "$f" ]; then + mysql_note "$0: running $f" + "$f" + else + mysql_note "$0: sourcing $f" + . "$f" + fi + ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index e7dd7592c..8db356750 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -58,7 +58,17 @@ docker_process_init_files() { local f for f; do case "$f" in - *.sh) mysql_note "$0: running $f"; . "$f" ;; + *.sh) + # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 + # https://github.com/docker-library/postgres/pull/452 + if [ -x "$f" ]; then + mysql_note "$0: running $f" + "$f" + else + mysql_note "$0: sourcing $f" + . "$f" + fi + ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index e7dd7592c..8db356750 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -58,7 +58,17 @@ docker_process_init_files() { local f for f; do case "$f" in - *.sh) mysql_note "$0: running $f"; . "$f" ;; + *.sh) + # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 + # https://github.com/docker-library/postgres/pull/452 + if [ -x "$f" ]; then + mysql_note "$0: running $f" + "$f" + else + mysql_note "$0: sourcing $f" + . "$f" + fi + ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index e7dd7592c..8db356750 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -58,7 +58,17 @@ docker_process_init_files() { local f for f; do case "$f" in - *.sh) mysql_note "$0: running $f"; . "$f" ;; + *.sh) + # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 + # https://github.com/docker-library/postgres/pull/452 + if [ -x "$f" ]; then + mysql_note "$0: running $f" + "$f" + else + mysql_note "$0: sourcing $f" + . "$f" + fi + ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; From f7ba980b846fa5fd97423997e5ea0675600b185a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 16 Apr 2020 00:28:41 -0700 Subject: [PATCH 131/285] Update to gosu 1.12 --- 5.6/Dockerfile | 34 +++++++++++++++++++++------------- 5.7/Dockerfile | 34 +++++++++++++++++++++------------- 8.0/Dockerfile | 34 +++++++++++++++++++++------------- 3 files changed, 63 insertions(+), 39 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index b5ff1be5d..dc7adb439 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -6,19 +6,27 @@ RUN groupadd -r mysql && useradd -r -g mysql mysql RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* # add gosu for easy step-down from root -ENV GOSU_VERSION 1.7 -RUN set -x \ - && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ - && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ - && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ - && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ - && gpgconf --kill all \ - && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ - && chmod +x /usr/local/bin/gosu \ - && gosu nobody true \ - && apt-get purge -y --auto-remove ca-certificates wget +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.12 +RUN set -eux; \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends ca-certificates wget; \ + rm -rf /var/lib/apt/lists/*; \ + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true RUN mkdir /docker-entrypoint-initdb.d diff --git a/5.7/Dockerfile b/5.7/Dockerfile index ae03462a4..6ac169cbb 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -6,19 +6,27 @@ RUN groupadd -r mysql && useradd -r -g mysql mysql RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* # add gosu for easy step-down from root -ENV GOSU_VERSION 1.7 -RUN set -x \ - && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ - && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ - && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ - && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ - && gpgconf --kill all \ - && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ - && chmod +x /usr/local/bin/gosu \ - && gosu nobody true \ - && apt-get purge -y --auto-remove ca-certificates wget +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.12 +RUN set -eux; \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends ca-certificates wget; \ + rm -rf /var/lib/apt/lists/*; \ + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true RUN mkdir /docker-entrypoint-initdb.d diff --git a/8.0/Dockerfile b/8.0/Dockerfile index f14fc3cd1..11666f96f 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -6,19 +6,27 @@ RUN groupadd -r mysql && useradd -r -g mysql mysql RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* # add gosu for easy step-down from root -ENV GOSU_VERSION 1.7 -RUN set -x \ - && apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \ - && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ - && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ - && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ - && gpgconf --kill all \ - && rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ - && chmod +x /usr/local/bin/gosu \ - && gosu nobody true \ - && apt-get purge -y --auto-remove ca-certificates wget +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.12 +RUN set -eux; \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends ca-certificates wget; \ + rm -rf /var/lib/apt/lists/*; \ + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true RUN mkdir /docker-entrypoint-initdb.d From fef511444a9d2867c9e4e20f5b4062bc071c20a2 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 26 Apr 2020 16:15:07 +0000 Subject: [PATCH 132/285] Update to 8.0.20-1debian10 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 11666f96f..9753ec818 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -56,7 +56,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.19-1debian10 +ENV MYSQL_VERSION 8.0.20-1debian10 RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From d2ba5f1fd5c1f4002253b80575de9c759d22bb1e Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 26 Apr 2020 16:15:07 +0000 Subject: [PATCH 133/285] Update to 5.6.48-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index dc7adb439..115a1fe44 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -54,7 +54,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.47-1debian9 +ENV MYSQL_VERSION 5.6.48-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 7397711170daed7ebba3bf373af143e5179906fc Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 26 Apr 2020 16:15:07 +0000 Subject: [PATCH 134/285] Update to 5.7.30-1debian10 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 6ac169cbb..eecbcddfe 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -56,7 +56,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.29-1debian10 +ENV MYSQL_VERSION 5.7.30-1debian10 RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From ab668881676c26d2d33681df60132e627f6d409d Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 28 Apr 2020 15:13:25 -0700 Subject: [PATCH 135/285] Add initial GitHub Actions CI --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 30 ------------------------- README.md | 6 ++--- 3 files changed, 51 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..155ef3165 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: GitHub CI + +on: + pull_request: + push: + schedule: + - cron: 0 0 * * 0 + +defaults: + run: + shell: 'bash -Eeuo pipefail -x {0}' + +jobs: + + generate-jobs: + name: Generate Jobs + runs-on: ubuntu-latest + outputs: + strategy: ${{ steps.generate-jobs.outputs.strategy }} + steps: + - uses: actions/checkout@v1 + - id: generate-jobs + name: Generate Jobs + run: | + git clone --depth 1 https://github.com/docker-library/bashbrew.git -b master ~/bashbrew + strategy="$(~/bashbrew/scripts/github-actions/generate.sh)" + jq . <<<"$strategy" # sanity check / debugging aid + echo "::set-output name=strategy::$strategy" + + test: + needs: generate-jobs + strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }} + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v1 + - name: Prepare Environment + run: ${{ matrix.runs.prepare }} + - name: Pull Dependencies + run: ${{ matrix.runs.pull }} + - name: Build ${{ matrix.name }} + run: ${{ matrix.runs.build }} + - name: History ${{ matrix.name }} + run: ${{ matrix.runs.history }} + - name: Test ${{ matrix.name }} + run: ${{ matrix.runs.test }} + - name: '"docker images"' + run: ${{ matrix.runs.images }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bc09ca645..000000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: bash -services: docker - -env: - - VERSION=8.0 - - VERSION=5.7 - - VERSION=5.6 - -install: - - git clone https://github.com/docker-library/official-images.git ~/official-images - -before_script: - - env | sort - - wget -qO- 'https://github.com/tianon/pgp-happy-eyeballs/raw/master/hack-my-builds.sh' | bash - - cd "$VERSION" - - image="mysql:$VERSION" - -script: - - | - ( - set -Eeuo pipefail - set -x - docker build -t "$image" . - ~/official-images/test/run.sh "$image" - ) - -after_script: - - docker images - -# vim:set et ts=2 sw=2: diff --git a/README.md b/README.md index b71c48de5..4513e4ab7 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,11 @@ For outstanding `mysql` image PRs, check [PRs with the "library/mysql" label on --- -- [![build status badge](https://img.shields.io/travis/docker-library/mysql/master.svg?label=Travis%20CI)](https://travis-ci.org/docker-library/mysql/branches) -- [![build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/mysql.svg?label=Automated%20update.sh)](https://doi-janky.infosiftr.net/job/update.sh/job/mysql) +- [![build status badge](https://img.shields.io/github/workflow/status/docker-library/mysql/GitHub%20CI/master?label=GitHub%20CI)](https://github.com/docker-library/mysql/actions?query=workflow%3A%22GitHub+CI%22+branch%3Amaster) +- [![build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/mysql.svg?label=Automated%20update.sh)](https://doi-janky.infosiftr.net/job/update.sh/job/mysql/) | Build | Status | Badges | (per-arch) | |:-:|:-:|:-:|:-:| -| [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql) | [![put-shared build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql.svg?label=put-shared)](https://doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql) | +| [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql/) | [![put-shared build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql.svg?label=put-shared)](https://doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql/) | From 7a87af078153c8e819ffd19281cd914215b77a5d Mon Sep 17 00:00:00 2001 From: "Robin C. Ladiges" Date: Thu, 23 Apr 2020 18:16:20 +0200 Subject: [PATCH 136/285] Escape database underscore wildcard if the $MYSQL_DATABASE environment variable contains underscores ("_") they are now escaped, so that the GRANT matches exactly the given database name. --- .template.Debian/docker-entrypoint.sh | 2 +- 5.6/docker-entrypoint.sh | 2 +- 5.7/docker-entrypoint.sh | 2 +- 8.0/docker-entrypoint.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 8db356750..6845ee49b 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -284,7 +284,7 @@ docker_setup_db() { if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" - docker_process_sql --database=mysql <<<"GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" + docker_process_sql --database=mysql <<<"GRANT ALL ON \`${MYSQL_DATABASE//_/\\_}\`.* TO '$MYSQL_USER'@'%' ;" fi docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 8db356750..6845ee49b 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -284,7 +284,7 @@ docker_setup_db() { if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" - docker_process_sql --database=mysql <<<"GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" + docker_process_sql --database=mysql <<<"GRANT ALL ON \`${MYSQL_DATABASE//_/\\_}\`.* TO '$MYSQL_USER'@'%' ;" fi docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 8db356750..6845ee49b 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -284,7 +284,7 @@ docker_setup_db() { if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" - docker_process_sql --database=mysql <<<"GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" + docker_process_sql --database=mysql <<<"GRANT ALL ON \`${MYSQL_DATABASE//_/\\_}\`.* TO '$MYSQL_USER'@'%' ;" fi docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 8db356750..6845ee49b 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -284,7 +284,7 @@ docker_setup_db() { if [ -n "$MYSQL_DATABASE" ]; then mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" - docker_process_sql --database=mysql <<<"GRANT ALL ON \`$MYSQL_DATABASE\`.* TO '$MYSQL_USER'@'%' ;" + docker_process_sql --database=mysql <<<"GRANT ALL ON \`${MYSQL_DATABASE//_/\\_}\`.* TO '$MYSQL_USER'@'%' ;" fi docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" From 44040f45a1a1a6236ef1aacb06ceaefea68960a4 Mon Sep 17 00:00:00 2001 From: lrf141 Date: Tue, 26 May 2020 09:24:44 +0900 Subject: [PATCH 137/285] Removed deprecated options --- 8.0/config/my.cnf | 2 -- 1 file changed, 2 deletions(-) diff --git a/8.0/config/my.cnf b/8.0/config/my.cnf index e9f2eda42..1f2511ce6 100644 --- a/8.0/config/my.cnf +++ b/8.0/config/my.cnf @@ -24,8 +24,6 @@ pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql secure-file-priv= NULL -# Disabling symbolic-links is recommended to prevent assorted security risks -symbolic-links=0 # Custom config should go here !includedir /etc/mysql/conf.d/ From a6b87c55ecdf9426d42ff7814be7e9b1fc33b292 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 12 Jul 2020 16:15:07 +0000 Subject: [PATCH 138/285] Update to 5.7.31-1debian10 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index eecbcddfe..01e0ba096 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -56,7 +56,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.30-1debian10 +ENV MYSQL_VERSION 5.7.31-1debian10 RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 01a48696e18aa6372cc47c57e9217af0b35b93bf Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 12 Jul 2020 16:15:07 +0000 Subject: [PATCH 139/285] Update to 8.0.21-1debian10 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 9753ec818..e4c39ce75 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -56,7 +56,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.20-1debian10 +ENV MYSQL_VERSION 8.0.21-1debian10 RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 3607c86e534658529a638e7616bfc1e02528e667 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 12 Jul 2020 16:15:07 +0000 Subject: [PATCH 140/285] Update to 5.6.49-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 115a1fe44..a6fd07296 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -54,7 +54,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.48-1debian9 +ENV MYSQL_VERSION 5.6.49-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 285fd39122e4b04fbe18e464deb72977df9c6a45 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Tue, 1 Sep 2020 13:17:25 -0700 Subject: [PATCH 141/285] Make arbitrary user work better out-of-the-box --- 5.6/Dockerfile | 2 +- 5.7/Dockerfile | 2 +- 8.0/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index a6fd07296..4bd61e704 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -70,7 +70,7 @@ RUN { \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 777 /var/run/mysqld \ + && chmod 1777 /var/run/mysqld /var/lib/mysql \ # comment out a few problematic configuration values && find /etc/mysql/ -name '*.cnf' -print0 \ | xargs -0 grep -lZE '^(bind-address|log)' \ diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 01e0ba096..4c83649e2 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -72,7 +72,7 @@ RUN { \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 777 /var/run/mysqld \ + && chmod 1777 /var/run/mysqld /var/lib/mysql \ # comment out a few problematic configuration values && find /etc/mysql/ -name '*.cnf' -print0 \ | xargs -0 grep -lZE '^(bind-address|log)' \ diff --git a/8.0/Dockerfile b/8.0/Dockerfile index e4c39ce75..1b0736f1f 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -72,7 +72,7 @@ RUN { \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 777 /var/run/mysqld + && chmod 1777 /var/run/mysqld /var/lib/mysql VOLUME /var/lib/mysql # Config files From 2e18165feaeeac8ec1b68ef68945d22fd73f817f Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 28 Sep 2020 14:33:37 -0700 Subject: [PATCH 142/285] Fix typo ("initializaed") --- .template.Debian/docker-entrypoint.sh | 2 +- 5.6/docker-entrypoint.sh | 2 +- 5.7/docker-entrypoint.sh | 2 +- 8.0/docker-entrypoint.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 6845ee49b..1e4d134ae 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -102,7 +102,7 @@ docker_temp_server_start() { mysql_note "Waiting for server startup" local i for i in {30..0}; do - # only use the root password if the database has already been initializaed + # only use the root password if the database has already been initialized # so that it won't try to fill in a password file when it hasn't been set yet extraArgs=() if [ -z "$DATABASE_ALREADY_EXISTS" ]; then diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 6845ee49b..1e4d134ae 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -102,7 +102,7 @@ docker_temp_server_start() { mysql_note "Waiting for server startup" local i for i in {30..0}; do - # only use the root password if the database has already been initializaed + # only use the root password if the database has already been initialized # so that it won't try to fill in a password file when it hasn't been set yet extraArgs=() if [ -z "$DATABASE_ALREADY_EXISTS" ]; then diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 6845ee49b..1e4d134ae 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -102,7 +102,7 @@ docker_temp_server_start() { mysql_note "Waiting for server startup" local i for i in {30..0}; do - # only use the root password if the database has already been initializaed + # only use the root password if the database has already been initialized # so that it won't try to fill in a password file when it hasn't been set yet extraArgs=() if [ -z "$DATABASE_ALREADY_EXISTS" ]; then diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 6845ee49b..1e4d134ae 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -102,7 +102,7 @@ docker_temp_server_start() { mysql_note "Waiting for server startup" local i for i in {30..0}; do - # only use the root password if the database has already been initializaed + # only use the root password if the database has already been initialized # so that it won't try to fill in a password file when it hasn't been set yet extraArgs=() if [ -z "$DATABASE_ALREADY_EXISTS" ]; then From c0dc027ceb83f9daba6b8f5fbc69dac33feed174 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 18 Oct 2020 16:15:06 +0000 Subject: [PATCH 143/285] Update to 5.7.32-1debian10 --- 5.7/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.7/Dockerfile b/5.7/Dockerfile index 4c83649e2..ec29229a8 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile @@ -56,7 +56,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.31-1debian10 +ENV MYSQL_VERSION 5.7.32-1debian10 RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 37834b44af39889eeba57452a404f12b5882a408 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 18 Oct 2020 16:15:06 +0000 Subject: [PATCH 144/285] Update to 5.6.50-1debian9 --- 5.6/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 4bd61e704..bfdf1b19b 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -54,7 +54,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.49-1debian9 +ENV MYSQL_VERSION 5.6.50-1debian9 RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 234befee1071c0cd292f2392895d13ee94ce2a02 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 18 Oct 2020 16:15:06 +0000 Subject: [PATCH 145/285] Update to 8.0.22-1debian10 --- 8.0/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/Dockerfile b/8.0/Dockerfile index 1b0736f1f..16f5d9dc7 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile @@ -56,7 +56,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.21-1debian10 +ENV MYSQL_VERSION 8.0.22-1debian10 RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list From 1a25a09159a3d7b6b5b8ad0e6c7eb53504b3aab5 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Wed, 21 Oct 2020 14:00:47 -0700 Subject: [PATCH 146/285] no flush privs needed after grant/create user --- .template.Debian/docker-entrypoint.sh | 2 -- 5.6/docker-entrypoint.sh | 2 -- 5.7/docker-entrypoint.sh | 2 -- 8.0/docker-entrypoint.sh | 2 -- 4 files changed, 8 deletions(-) diff --git a/.template.Debian/docker-entrypoint.sh b/.template.Debian/docker-entrypoint.sh index 1e4d134ae..83d6ffe5e 100755 --- a/.template.Debian/docker-entrypoint.sh +++ b/.template.Debian/docker-entrypoint.sh @@ -286,8 +286,6 @@ docker_setup_db() { mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"GRANT ALL ON \`${MYSQL_DATABASE//_/\\_}\`.* TO '$MYSQL_USER'@'%' ;" fi - - docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" fi } diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 1e4d134ae..83d6ffe5e 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -286,8 +286,6 @@ docker_setup_db() { mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"GRANT ALL ON \`${MYSQL_DATABASE//_/\\_}\`.* TO '$MYSQL_USER'@'%' ;" fi - - docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" fi } diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 1e4d134ae..83d6ffe5e 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -286,8 +286,6 @@ docker_setup_db() { mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"GRANT ALL ON \`${MYSQL_DATABASE//_/\\_}\`.* TO '$MYSQL_USER'@'%' ;" fi - - docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" fi } diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 1e4d134ae..83d6ffe5e 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -286,8 +286,6 @@ docker_setup_db() { mysql_note "Giving user ${MYSQL_USER} access to schema ${MYSQL_DATABASE}" docker_process_sql --database=mysql <<<"GRANT ALL ON \`${MYSQL_DATABASE//_/\\_}\`.* TO '$MYSQL_USER'@'%' ;" fi - - docker_process_sql --database=mysql <<<"FLUSH PRIVILEGES ;" fi } From ee33a2144a0effe9459abf02f20a6202ae645e94 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Wed, 18 Nov 2020 15:07:31 -0800 Subject: [PATCH 147/285] Add initial jq-based templating engine --- .gitattributes | 3 + .github/workflows/verify-templating.yml | 22 ++++ .gitignore | 1 + 5.6/{Dockerfile => Dockerfile.debian} | 23 ++-- 5.7/{Dockerfile => Dockerfile.debian} | 23 ++-- 8.0/{Dockerfile => Dockerfile.debian} | 15 ++- apply-templates.sh | 45 +++++++ generate-stackbrew-library.sh | 33 +++--- template/Dockerfile.debian | 110 ++++++++++++++++++ .../docker-entrypoint.sh | 0 update.sh | 47 +------- versions.json | 32 +++++ versions.sh | 55 +++++++++ 13 files changed, 337 insertions(+), 72 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/verify-templating.yml create mode 100644 .gitignore rename 5.6/{Dockerfile => Dockerfile.debian} (90%) rename 5.7/{Dockerfile => Dockerfile.debian} (90%) rename 8.0/{Dockerfile => Dockerfile.debian} (90%) create mode 100755 apply-templates.sh create mode 100644 template/Dockerfile.debian rename {.template.Debian => template}/docker-entrypoint.sh (100%) create mode 100644 versions.json create mode 100755 versions.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..dfa02cc85 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +/*.*/**/Dockerfile* linguist-generated +/*.*/**/docker-entrypoint.sh linguist-generated +Dockerfile* linguist-language=Dockerfile diff --git a/.github/workflows/verify-templating.yml b/.github/workflows/verify-templating.yml new file mode 100644 index 000000000..7e833f1c7 --- /dev/null +++ b/.github/workflows/verify-templating.yml @@ -0,0 +1,22 @@ +name: Verify Templating + +on: + pull_request: + push: + +defaults: + run: + shell: 'bash -Eeuo pipefail -x {0}' + +jobs: + apply-templates: + name: Check For Uncomitted Changes + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Apply Templates + run: ./apply-templates.sh + - name: Check Git Status + run: | + status="$(git status --short)" + [ -z "$status" ] diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..d548f66de --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.jq-template.awk diff --git a/5.6/Dockerfile b/5.6/Dockerfile.debian similarity index 90% rename from 5.6/Dockerfile rename to 5.6/Dockerfile.debian index bfdf1b19b..883438148 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile.debian @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:stretch-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added @@ -56,7 +62,7 @@ RUN set -ex; \ ENV MYSQL_MAJOR 5.6 ENV MYSQL_VERSION 5.6.50-1debian9 -RUN echo "deb http://repo.mysql.com/apt/debian/ stretch mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list +RUN echo 'deb http://repo.mysql.com/apt/debian/ stretch mysql-5.6' > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter @@ -66,17 +72,20 @@ RUN { \ echo mysql-community-server mysql-community-server/re-root-pass password ''; \ echo mysql-community-server mysql-community-server/remove-test-db select false; \ } | debconf-set-selections \ - && apt-get update && apt-get install -y mysql-server="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ - && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 1777 /var/run/mysqld /var/lib/mysql \ + && apt-get update \ + && apt-get install -y \ + mysql-server="${MYSQL_VERSION}" \ # comment out a few problematic configuration values && find /etc/mysql/ -name '*.cnf' -print0 \ | xargs -0 grep -lZE '^(bind-address|log)' \ | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \ # don't reverse lookup hostnames, they are usually another container - && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf + && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ + && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + && chmod 1777 /var/run/mysqld /var/lib/mysql VOLUME /var/lib/mysql diff --git a/5.7/Dockerfile b/5.7/Dockerfile.debian similarity index 90% rename from 5.7/Dockerfile rename to 5.7/Dockerfile.debian index ec29229a8..c4261bced 100644 --- a/5.7/Dockerfile +++ b/5.7/Dockerfile.debian @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:buster-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added @@ -58,7 +64,7 @@ RUN set -ex; \ ENV MYSQL_MAJOR 5.7 ENV MYSQL_VERSION 5.7.32-1debian10 -RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list +RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter @@ -68,17 +74,20 @@ RUN { \ echo mysql-community-server mysql-community-server/re-root-pass password ''; \ echo mysql-community-server mysql-community-server/remove-test-db select false; \ } | debconf-set-selections \ - && apt-get update && apt-get install -y mysql-server="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ - && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 1777 /var/run/mysqld /var/lib/mysql \ + && apt-get update \ + && apt-get install -y \ + mysql-server="${MYSQL_VERSION}" \ # comment out a few problematic configuration values && find /etc/mysql/ -name '*.cnf' -print0 \ | xargs -0 grep -lZE '^(bind-address|log)' \ | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \ # don't reverse lookup hostnames, they are usually another container - && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf + && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf \ + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ + && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + && chmod 1777 /var/run/mysqld /var/lib/mysql VOLUME /var/lib/mysql diff --git a/8.0/Dockerfile b/8.0/Dockerfile.debian similarity index 90% rename from 8.0/Dockerfile rename to 8.0/Dockerfile.debian index 16f5d9dc7..d3ba3cacf 100644 --- a/8.0/Dockerfile +++ b/8.0/Dockerfile.debian @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:buster-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added @@ -58,7 +64,7 @@ RUN set -ex; \ ENV MYSQL_MAJOR 8.0 ENV MYSQL_VERSION 8.0.22-1debian10 -RUN echo "deb http://repo.mysql.com/apt/debian/ buster mysql-${MYSQL_MAJOR}" > /etc/apt/sources.list.d/mysql.list +RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter @@ -68,13 +74,18 @@ RUN { \ echo mysql-community-server mysql-community-server/re-root-pass password ''; \ echo mysql-community-server mysql-community-server/remove-test-db select false; \ } | debconf-set-selections \ - && apt-get update && apt-get install -y mysql-community-client="${MYSQL_VERSION}" mysql-community-server-core="${MYSQL_VERSION}" && rm -rf /var/lib/apt/lists/* \ + && apt-get update \ + && apt-get install -y \ + mysql-community-client="${MYSQL_VERSION}" \ + mysql-community-server-core="${MYSQL_VERSION}" \ + && rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ # ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime && chmod 1777 /var/run/mysqld /var/lib/mysql VOLUME /var/lib/mysql + # Config files COPY config/ /etc/mysql/ COPY docker-entrypoint.sh /usr/local/bin/ diff --git a/apply-templates.sh b/apply-templates.sh new file mode 100755 index 000000000..f80f7670b --- /dev/null +++ b/apply-templates.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +[ -f versions.json ] # run "versions.sh" first + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" + +jqt='.jq-template.awk' +if [ -n "${BASHBREW_SCRIPTS:-}" ]; then + jqt="$BASHBREW_SCRIPTS/jq-template.awk" +elif [ "$BASH_SOURCE" -nt "$jqt" ]; then + wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/5f0c26381fb7cc78b2d217d58007800bdcfbcfa1/scripts/jq-template.awk' +fi + +if [ "$#" -eq 0 ]; then + versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" + eval "set -- $versions" +fi + +generated_warning() { + cat <<-EOH + # + # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" + # + # PLEASE DO NOT EDIT IT DIRECTLY. + # + + EOH +} + +for version; do + export version + + debianVersion="$(jq -r '.[env.version].debian // ""' versions.json)" + if [ -n "$debianVersion" ]; then + dockerfile='Dockerfile.debian' + + { + generated_warning + gawk -f "$jqt" "template/$dockerfile" + } > "$version/$dockerfile" + fi + + cp -a template/docker-entrypoint.sh "$version/docker-entrypoint.sh" +done diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index a4a7f55d6..a6940e74a 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -1,5 +1,5 @@ -#!/bin/bash -set -eu +#!/usr/bin/env bash +set -Eeuo pipefail declare -A aliases=( [5.7]='5' @@ -9,31 +9,35 @@ declare -A aliases=( self="$(basename "$BASH_SOURCE")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -versions=( */ ) -versions=( "${versions[@]%/}" ) +if [ "$#" -eq 0 ]; then + versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" + eval "set -- $versions" +fi # sort version numbers with highest first -IFS=$'\n'; versions=( $(echo "${versions[*]}" | sort -rV) ); unset IFS +IFS=$'\n'; set -- $(sort -rV <<<"$*"); unset IFS # get the most recent commit which modified any of "$@" fileCommit() { git log -1 --format='format:%H' HEAD -- "$@" } -# get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile" +# get the most recent commit which modified "dir/dockerfile" or any file COPY'd from it dirCommit() { local dir="$1"; shift + local df="$1"; shift ( cd "$dir" - fileCommit \ - Dockerfile \ - $(git show HEAD:./Dockerfile | awk ' + local files; files="$( + git show "HEAD:./$df" | awk ' toupper($1) == "COPY" { for (i = 2; i < NF; i++) { print $i } } - ') + ' + )" + fileCommit "$df" $files ) } @@ -52,10 +56,12 @@ join() { echo "${out#$sep}" } -for version in "${versions[@]}"; do - commit="$(dirCommit "$version")" +for version; do + export version + df='Dockerfile.debian' + commit="$(dirCommit "$version" "$df")" - fullVersion="$(git show "$commit":"$version/Dockerfile" | awk '$1 == "ENV" && $2 == "MYSQL_VERSION" { gsub(/-[0-9].*$/, "", $3); print $3; exit }')" + fullVersion="$(jq -r '.[env.version].version' versions.json)" versionAliases=() while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do @@ -72,5 +78,6 @@ for version in "${versions[@]}"; do Tags: $(join ', ' "${versionAliases[@]}") GitCommit: $commit Directory: $version + File: $df EOE done diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian new file mode 100644 index 000000000..092cc57e0 --- /dev/null +++ b/template/Dockerfile.debian @@ -0,0 +1,110 @@ +FROM debian:{{ .debian.suite }}-slim + +# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added +RUN groupadd -r mysql && useradd -r -g mysql mysql + +RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* + +# add gosu for easy step-down from root +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.12 +RUN set -eux; \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends ca-certificates wget; \ + rm -rf /var/lib/apt/lists/*; \ + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true + +RUN mkdir /docker-entrypoint-initdb.d + +RUN apt-get update && apt-get install -y --no-install-recommends \ +# for MYSQL_RANDOM_ROOT_PASSWORD + pwgen \ +{{ + if env.version != "5.6" then ( +-}} +# for mysql_ssl_rsa_setup + openssl \ +{{ ) else "" end -}} +# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: +# File::Basename +# File::Copy +# Sys::Hostname +# Data::Dumper + perl \ +# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files + xz-utils \ + && rm -rf /var/lib/apt/lists/* + +RUN set -ex; \ +# gpg: key 5072E1F5: public key "MySQL Release Engineering " imported + key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + apt-key list > /dev/null + +ENV MYSQL_MAJOR {{ env.version }} +ENV MYSQL_VERSION {{ .debian.version }} + +RUN echo 'deb http://repo.mysql.com/apt/debian/ {{ .debian.suite }} mysql-{{ env.version }}' > /etc/apt/sources.list.d/mysql.list + +# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) +# also, we set debconf keys to make APT a little quieter +RUN { \ + echo mysql-community-server mysql-community-server/data-dir select ''; \ + echo mysql-community-server mysql-community-server/root-pass password ''; \ + echo mysql-community-server mysql-community-server/re-root-pass password ''; \ + echo mysql-community-server mysql-community-server/remove-test-db select false; \ + } | debconf-set-selections \ + && apt-get update \ + && apt-get install -y \ +{{ if env.version == "5.6" or env.version == "5.7" then ( -}} + mysql-server="${MYSQL_VERSION}" \ +# comment out a few problematic configuration values + && find /etc/mysql/ -name '*.cnf' -print0 \ + | xargs -0 grep -lZE '^(bind-address|log)' \ + | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \ +# don't reverse lookup hostnames, they are usually another container + && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf \ +{{ ) else ( -}} + mysql-community-client="${MYSQL_VERSION}" \ + mysql-community-server-core="${MYSQL_VERSION}" \ +{{ ) end -}} + && rm -rf /var/lib/apt/lists/* \ + && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ + && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + && chmod 1777 /var/run/mysqld /var/lib/mysql + +VOLUME /var/lib/mysql + +{{ if env.version != "5.6" and env.version != "5.7" then ( -}} +# Config files +COPY config/ /etc/mysql/ +{{ ) else "" end -}} +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + +{{ if env.version != "5.6" then ( -}} +EXPOSE 3306 33060 +{{ ) else ( -}} +EXPOSE 3306 +{{ ) end -}} +CMD ["mysqld"] diff --git a/.template.Debian/docker-entrypoint.sh b/template/docker-entrypoint.sh similarity index 100% rename from .template.Debian/docker-entrypoint.sh rename to template/docker-entrypoint.sh diff --git a/update.sh b/update.sh index 75a2ecdf2..bac2d7581 100755 --- a/update.sh +++ b/update.sh @@ -1,46 +1,7 @@ -#!/bin/bash -set -e +#!/usr/bin/env bash +set -Eeuo pipefail cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -versions=( "$@" ) -if [ ${#versions[@]} -eq 0 ]; then - versions=( */ ) -fi -versions=( "${versions[@]%/}" ) - -defaultDebianVariant='buster-slim' -declare -A debianVariants=( - [5.6]='stretch-slim' -) - -for version in "${versions[@]}"; do - debianVariant="${debianVariants[$version]:-$defaultDebianVariant}" - debianSuite="${debianVariant%%-*}" # "buster", etc - - cp -a .template.Debian/docker-entrypoint.sh "$version/docker-entrypoint.sh" - - fullVersion="$( - curl -fsSL "https://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ - | gunzip \ - | awk -F ': ' ' - $1 == "Package" { - pkg = $2 - next - } - pkg == "mysql-server" && $1 == "Version" { - print $2 - } - ' - )" - - ( - set -x - sed -ri \ - -e 's/^(ENV MYSQL_VERSION) .*/\1 '"$fullVersion"'/' \ - -e 's/^(ENV MYSQL_MAJOR) .*/\1 '"$version"'/' \ - -e 's/^(FROM) .*/\1 debian:'"$debianVariant"'/' \ - -e 's!(http://repo.mysql.com/apt/debian/) [^ ]+!\1 '"$debianSuite"'!' \ - "$version/Dockerfile" - ) -done +./versions.sh "$@" +./apply-templates.sh "$@" diff --git a/versions.json b/versions.json new file mode 100644 index 000000000..cceb6192c --- /dev/null +++ b/versions.json @@ -0,0 +1,32 @@ +{ + "5.6": { + "debian": { + "architectures": [ + "amd64" + ], + "suite": "stretch", + "version": "5.6.50-1debian9" + }, + "version": "5.6.50" + }, + "5.7": { + "debian": { + "architectures": [ + "amd64" + ], + "suite": "buster", + "version": "5.7.32-1debian10" + }, + "version": "5.7.32" + }, + "8.0": { + "debian": { + "architectures": [ + "amd64" + ], + "suite": "buster", + "version": "8.0.22-1debian10" + }, + "version": "8.0.22" + } +} diff --git a/versions.sh b/versions.sh new file mode 100755 index 000000000..e475d0b78 --- /dev/null +++ b/versions.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +defaultDebianSuite='buster' +declare -A debianSuites=( + [5.6]='stretch' +) + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" + +versions=( "$@" ) +if [ ${#versions[@]} -eq 0 ]; then + versions=( *.*/ ) + json='{}' +else + json="$(< versions.json)" +fi +versions=( "${versions[@]%/}" ) + +for version in "${versions[@]}"; do + export version + + debianSuite="${debianSuites[$version]:-$defaultDebianSuite}" + debianVersion="$( + curl -fsSL "https://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ + | gunzip \ + | awk -F ': ' ' + $1 == "Package" { + pkg = $2 + next + } + pkg == "mysql-server" && $1 == "Version" { + print $2 + } + ' + )" + + # example 8.0.22-1debian10 => 8.0.22 + baseVersion="${debianVersion%-*}" + + export baseVersion debianSuite debianVersion + json="$( + jq <<<"$json" -c \ + '.[env.version] = { + version: env.baseVersion, + debian: { + architectures: [ "amd64" ], + suite: env.debianSuite, + version: env.debianVersion, + }, + }' + )" +done + +jq <<<"$json" -S . > versions.json From b0a0e546712534b30ac13e8b2829f23654facbc5 Mon Sep 17 00:00:00 2001 From: Marc Bennewitz Date: Sat, 14 Nov 2020 15:40:20 +0100 Subject: [PATCH 148/285] Execute SQL in entrypoint with "--comments" The primary reason to disable this seems to be to avoid normally-unnecessary data transfer, but in this case we're explicitly connecting over the local unix socket, so streaming the comments to the server and letting it strip them should be *almost* as efficient as the client doing so. --- 5.6/docker-entrypoint.sh | 2 +- 5.7/docker-entrypoint.sh | 2 +- 8.0/docker-entrypoint.sh | 2 +- template/docker-entrypoint.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 83d6ffe5e..bd0dc689d 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -208,7 +208,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" --comments "$@" } # Initializes database with timezone info and root password, plus optional extra db/user diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 83d6ffe5e..bd0dc689d 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -208,7 +208,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" --comments "$@" } # Initializes database with timezone info and root password, plus optional extra db/user diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 83d6ffe5e..bd0dc689d 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -208,7 +208,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" --comments "$@" } # Initializes database with timezone info and root password, plus optional extra db/user diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index 83d6ffe5e..bd0dc689d 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -208,7 +208,7 @@ docker_process_sql() { set -- --database="$MYSQL_DATABASE" "$@" fi - mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" + mysql --defaults-extra-file=<( _mysql_passfile "${passfileArgs[@]}") --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" --comments "$@" } # Initializes database with timezone info and root password, plus optional extra db/user From 3fde29717aea785d4e37a97c9990ff0fda37e544 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 17 Jan 2021 17:15:10 +0000 Subject: [PATCH 149/285] Update 5.7 to 5.7.33, debian 5.7.33-1debian10 --- 5.7/Dockerfile.debian | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index c4261bced..531b9039e 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.32-1debian10 +ENV MYSQL_VERSION 5.7.33-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index cceb6192c..dcaa0aadd 100644 --- a/versions.json +++ b/versions.json @@ -15,9 +15,9 @@ "amd64" ], "suite": "buster", - "version": "5.7.32-1debian10" + "version": "5.7.33-1debian10" }, - "version": "5.7.32" + "version": "5.7.33" }, "8.0": { "debian": { From d72fdef749b3b6c140e4b0d6a87f12737ed3554a Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Sun, 17 Jan 2021 17:17:26 +0000 Subject: [PATCH 150/285] Update 8.0 to 8.0.23, debian 8.0.23-1debian10 --- 8.0/Dockerfile.debian | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index d3ba3cacf..5977fffd3 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.22-1debian10 +ENV MYSQL_VERSION 8.0.23-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index dcaa0aadd..e2338a5d6 100644 --- a/versions.json +++ b/versions.json @@ -25,8 +25,8 @@ "amd64" ], "suite": "buster", - "version": "8.0.22-1debian10" + "version": "8.0.23-1debian10" }, - "version": "8.0.22" + "version": "8.0.23" } } From c273193c14bb45daea2d27bb6ec51aa0b2b2ab9b Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 19 Jan 2021 17:15:14 +0000 Subject: [PATCH 151/285] Update 5.6 to 5.6.51, debian 5.6.51-1debian9 --- 5.6/Dockerfile.debian | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.6/Dockerfile.debian b/5.6/Dockerfile.debian index 883438148..87570ebe7 100644 --- a/5.6/Dockerfile.debian +++ b/5.6/Dockerfile.debian @@ -60,7 +60,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.50-1debian9 +ENV MYSQL_VERSION 5.6.51-1debian9 RUN echo 'deb http://repo.mysql.com/apt/debian/ stretch mysql-5.6' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index e2338a5d6..6b1940a62 100644 --- a/versions.json +++ b/versions.json @@ -5,9 +5,9 @@ "amd64" ], "suite": "stretch", - "version": "5.6.50-1debian9" + "version": "5.6.51-1debian9" }, - "version": "5.6.50" + "version": "5.6.51" }, "5.7": { "debian": { From c2aeba599333c01d70573892352e398222bb8c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 11 Feb 2021 00:09:00 +0200 Subject: [PATCH 152/285] Override time-zone option when initializing database Initializing database with a config that specifies `default-time-zone` ends up with an error: > Fatal error: Illegal or unknown default time zone 'Europe/Tallinn' This adds a workaround to the problem to force the system timezone, so the database can be initialized, and timezones be imported after database init. --- 5.6/docker-entrypoint.sh | 8 ++++---- 5.7/docker-entrypoint.sh | 8 ++++---- 8.0/docker-entrypoint.sh | 8 ++++---- template/docker-entrypoint.sh | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index bd0dc689d..4c2b3e358 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -98,7 +98,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then - "$@" --skip-networking --socket="${SOCKET}" & + "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i for i in {30..0}; do @@ -118,7 +118,7 @@ docker_temp_server_start() { fi else # For 5.7+ the server is ready for use as soon as startup command unblocks - if ! "$@" --daemonize --skip-networking --socket="${SOCKET}"; then + if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then mysql_error "Unable to start server." fi fi @@ -158,9 +158,9 @@ docker_create_db_directories() { docker_init_database_dir() { mysql_note "Initializing database files" if [ "$MYSQL_MAJOR" = '5.6' ]; then - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" + mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" --default-time-zone=SYSTEM else - "$@" --initialize-insecure + "$@" --initialize-insecure --default-time-zone=SYSTEM fi mysql_note "Database files initialized" diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index bd0dc689d..4c2b3e358 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -98,7 +98,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then - "$@" --skip-networking --socket="${SOCKET}" & + "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i for i in {30..0}; do @@ -118,7 +118,7 @@ docker_temp_server_start() { fi else # For 5.7+ the server is ready for use as soon as startup command unblocks - if ! "$@" --daemonize --skip-networking --socket="${SOCKET}"; then + if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then mysql_error "Unable to start server." fi fi @@ -158,9 +158,9 @@ docker_create_db_directories() { docker_init_database_dir() { mysql_note "Initializing database files" if [ "$MYSQL_MAJOR" = '5.6' ]; then - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" + mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" --default-time-zone=SYSTEM else - "$@" --initialize-insecure + "$@" --initialize-insecure --default-time-zone=SYSTEM fi mysql_note "Database files initialized" diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index bd0dc689d..4c2b3e358 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -98,7 +98,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then - "$@" --skip-networking --socket="${SOCKET}" & + "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i for i in {30..0}; do @@ -118,7 +118,7 @@ docker_temp_server_start() { fi else # For 5.7+ the server is ready for use as soon as startup command unblocks - if ! "$@" --daemonize --skip-networking --socket="${SOCKET}"; then + if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then mysql_error "Unable to start server." fi fi @@ -158,9 +158,9 @@ docker_create_db_directories() { docker_init_database_dir() { mysql_note "Initializing database files" if [ "$MYSQL_MAJOR" = '5.6' ]; then - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" + mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" --default-time-zone=SYSTEM else - "$@" --initialize-insecure + "$@" --initialize-insecure --default-time-zone=SYSTEM fi mysql_note "Database files initialized" diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index bd0dc689d..4c2b3e358 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -98,7 +98,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then - "$@" --skip-networking --socket="${SOCKET}" & + "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i for i in {30..0}; do @@ -118,7 +118,7 @@ docker_temp_server_start() { fi else # For 5.7+ the server is ready for use as soon as startup command unblocks - if ! "$@" --daemonize --skip-networking --socket="${SOCKET}"; then + if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then mysql_error "Unable to start server." fi fi @@ -158,9 +158,9 @@ docker_create_db_directories() { docker_init_database_dir() { mysql_note "Initializing database files" if [ "$MYSQL_MAJOR" = '5.6' ]; then - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" + mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" --default-time-zone=SYSTEM else - "$@" --initialize-insecure + "$@" --initialize-insecure --default-time-zone=SYSTEM fi mysql_note "Database files initialized" From 2966bfbd71cf370770cd880aa45f3c8f155d0aae Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 16 Feb 2021 10:47:05 -0800 Subject: [PATCH 153/285] Add consistent variable for "--verbose --help" arguments Given these are duplicated (or should be -- as seen in the diff we already messed this up!) it makes sense to make them share a common variable. --- 5.6/docker-entrypoint.sh | 10 ++++++++-- 5.7/docker-entrypoint.sh | 10 ++++++++-- 8.0/docker-entrypoint.sh | 10 ++++++++-- template/docker-entrypoint.sh | 10 ++++++++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index bd0dc689d..8f510f17e 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -78,8 +78,14 @@ docker_process_init_files() { done } +# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) +_verboseHelpArgs=( + --verbose --help + --log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136 +) + mysql_check_config() { - local toRun=( "$@" --verbose --help ) errors + local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" fi @@ -90,7 +96,7 @@ mysql_check_config() { # latter only show values present in config files, and not server defaults mysql_get_config() { local conf="$1"; shift - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ + "$@" "${_verboseHelpArgs[@]}" 2>/dev/null \ | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index bd0dc689d..8f510f17e 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -78,8 +78,14 @@ docker_process_init_files() { done } +# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) +_verboseHelpArgs=( + --verbose --help + --log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136 +) + mysql_check_config() { - local toRun=( "$@" --verbose --help ) errors + local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" fi @@ -90,7 +96,7 @@ mysql_check_config() { # latter only show values present in config files, and not server defaults mysql_get_config() { local conf="$1"; shift - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ + "$@" "${_verboseHelpArgs[@]}" 2>/dev/null \ | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index bd0dc689d..8f510f17e 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -78,8 +78,14 @@ docker_process_init_files() { done } +# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) +_verboseHelpArgs=( + --verbose --help + --log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136 +) + mysql_check_config() { - local toRun=( "$@" --verbose --help ) errors + local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" fi @@ -90,7 +96,7 @@ mysql_check_config() { # latter only show values present in config files, and not server defaults mysql_get_config() { local conf="$1"; shift - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ + "$@" "${_verboseHelpArgs[@]}" 2>/dev/null \ | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index bd0dc689d..8f510f17e 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -78,8 +78,14 @@ docker_process_init_files() { done } +# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) +_verboseHelpArgs=( + --verbose --help + --log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136 +) + mysql_check_config() { - local toRun=( "$@" --verbose --help ) errors + local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" fi @@ -90,7 +96,7 @@ mysql_check_config() { # latter only show values present in config files, and not server defaults mysql_get_config() { local conf="$1"; shift - "$@" --verbose --help --log-bin-index="$(mktemp -u)" 2>/dev/null \ + "$@" "${_verboseHelpArgs[@]}" 2>/dev/null \ | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } From 6a9edebd6ed7b0178b0cce7495bea1777cb9f128 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Tue, 16 Mar 2021 15:52:13 -0700 Subject: [PATCH 154/285] Error early if MYSQL_USER=root to prevent partially initialized databases - warning when only one of MYSQL_USER and MYSQL_PASSWORD is supplied - improved `mysql_log` functions to accept `stdin` for the text --- 5.6/docker-entrypoint.sh | 31 +++++++++++++++++++++++++++++-- 5.7/docker-entrypoint.sh | 31 +++++++++++++++++++++++++++++-- 8.0/docker-entrypoint.sh | 31 +++++++++++++++++++++++++++++-- template/docker-entrypoint.sh | 31 +++++++++++++++++++++++++++++-- 4 files changed, 116 insertions(+), 8 deletions(-) diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 8f510f17e..461e34bac 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -5,7 +5,10 @@ shopt -s nullglob # logging functions mysql_log() { local type="$1"; shift - printf '%s [%s] [Entrypoint]: %s\n' "$(date --rfc-3339=seconds)" "$type" "$*" + # accept argument string or stdin + local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi + local dt; dt="$(date --rfc-3339=seconds)" + printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text" } mysql_note() { mysql_log Note "$@" @@ -141,7 +144,31 @@ docker_temp_server_stop() { # Verify that the minimally required password settings are set for new databases. docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error $'Database is uninitialized and password option is not specified\n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' + mysql_error <<-'EOF' + Database is uninitialized and password option is not specified + You need to specify one of the following: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) + if [ "$MYSQL_USER" = 'root' ]; then + mysql_error <<-'EOF' + MYSQL_USER="root", MYSQL_PASSWORD cannot be used for the root user + Use one of the following to control the root user password: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # warn when missing one of MYSQL_USER or MYSQL_PASSWORD + if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created' + elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored' fi } diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 8f510f17e..461e34bac 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -5,7 +5,10 @@ shopt -s nullglob # logging functions mysql_log() { local type="$1"; shift - printf '%s [%s] [Entrypoint]: %s\n' "$(date --rfc-3339=seconds)" "$type" "$*" + # accept argument string or stdin + local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi + local dt; dt="$(date --rfc-3339=seconds)" + printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text" } mysql_note() { mysql_log Note "$@" @@ -141,7 +144,31 @@ docker_temp_server_stop() { # Verify that the minimally required password settings are set for new databases. docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error $'Database is uninitialized and password option is not specified\n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' + mysql_error <<-'EOF' + Database is uninitialized and password option is not specified + You need to specify one of the following: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) + if [ "$MYSQL_USER" = 'root' ]; then + mysql_error <<-'EOF' + MYSQL_USER="root", MYSQL_PASSWORD cannot be used for the root user + Use one of the following to control the root user password: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # warn when missing one of MYSQL_USER or MYSQL_PASSWORD + if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created' + elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored' fi } diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 8f510f17e..461e34bac 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -5,7 +5,10 @@ shopt -s nullglob # logging functions mysql_log() { local type="$1"; shift - printf '%s [%s] [Entrypoint]: %s\n' "$(date --rfc-3339=seconds)" "$type" "$*" + # accept argument string or stdin + local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi + local dt; dt="$(date --rfc-3339=seconds)" + printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text" } mysql_note() { mysql_log Note "$@" @@ -141,7 +144,31 @@ docker_temp_server_stop() { # Verify that the minimally required password settings are set for new databases. docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error $'Database is uninitialized and password option is not specified\n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' + mysql_error <<-'EOF' + Database is uninitialized and password option is not specified + You need to specify one of the following: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) + if [ "$MYSQL_USER" = 'root' ]; then + mysql_error <<-'EOF' + MYSQL_USER="root", MYSQL_PASSWORD cannot be used for the root user + Use one of the following to control the root user password: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # warn when missing one of MYSQL_USER or MYSQL_PASSWORD + if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created' + elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored' fi } diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index 8f510f17e..461e34bac 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -5,7 +5,10 @@ shopt -s nullglob # logging functions mysql_log() { local type="$1"; shift - printf '%s [%s] [Entrypoint]: %s\n' "$(date --rfc-3339=seconds)" "$type" "$*" + # accept argument string or stdin + local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi + local dt; dt="$(date --rfc-3339=seconds)" + printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text" } mysql_note() { mysql_log Note "$@" @@ -141,7 +144,31 @@ docker_temp_server_stop() { # Verify that the minimally required password settings are set for new databases. docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error $'Database is uninitialized and password option is not specified\n\tYou need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD' + mysql_error <<-'EOF' + Database is uninitialized and password option is not specified + You need to specify one of the following: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) + if [ "$MYSQL_USER" = 'root' ]; then + mysql_error <<-'EOF' + MYSQL_USER="root", MYSQL_PASSWORD cannot be used for the root user + Use one of the following to control the root user password: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # warn when missing one of MYSQL_USER or MYSQL_PASSWORD + if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created' + elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored' fi } From dd8e5db3bc7c717542eb867b6addde7ccc9003e2 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Thu, 18 Mar 2021 11:48:09 -0700 Subject: [PATCH 155/285] Improve error message clarity when MYSQL_USER="root" --- 5.6/docker-entrypoint.sh | 4 ++-- 5.7/docker-entrypoint.sh | 4 ++-- 8.0/docker-entrypoint.sh | 4 ++-- template/docker-entrypoint.sh | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh index 461e34bac..62e6a876b 100755 --- a/5.6/docker-entrypoint.sh +++ b/5.6/docker-entrypoint.sh @@ -156,8 +156,8 @@ docker_verify_minimum_env() { # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) if [ "$MYSQL_USER" = 'root' ]; then mysql_error <<-'EOF' - MYSQL_USER="root", MYSQL_PASSWORD cannot be used for the root user - Use one of the following to control the root user password: + MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user + Remove MYSQL_USER="root" and use one of the following to control the root user password: - MYSQL_ROOT_PASSWORD - MYSQL_ALLOW_EMPTY_PASSWORD - MYSQL_RANDOM_ROOT_PASSWORD diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 461e34bac..62e6a876b 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -156,8 +156,8 @@ docker_verify_minimum_env() { # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) if [ "$MYSQL_USER" = 'root' ]; then mysql_error <<-'EOF' - MYSQL_USER="root", MYSQL_PASSWORD cannot be used for the root user - Use one of the following to control the root user password: + MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user + Remove MYSQL_USER="root" and use one of the following to control the root user password: - MYSQL_ROOT_PASSWORD - MYSQL_ALLOW_EMPTY_PASSWORD - MYSQL_RANDOM_ROOT_PASSWORD diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 461e34bac..62e6a876b 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -156,8 +156,8 @@ docker_verify_minimum_env() { # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) if [ "$MYSQL_USER" = 'root' ]; then mysql_error <<-'EOF' - MYSQL_USER="root", MYSQL_PASSWORD cannot be used for the root user - Use one of the following to control the root user password: + MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user + Remove MYSQL_USER="root" and use one of the following to control the root user password: - MYSQL_ROOT_PASSWORD - MYSQL_ALLOW_EMPTY_PASSWORD - MYSQL_RANDOM_ROOT_PASSWORD diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index 461e34bac..62e6a876b 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -156,8 +156,8 @@ docker_verify_minimum_env() { # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) if [ "$MYSQL_USER" = 'root' ]; then mysql_error <<-'EOF' - MYSQL_USER="root", MYSQL_PASSWORD cannot be used for the root user - Use one of the following to control the root user password: + MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user + Remove MYSQL_USER="root" and use one of the following to control the root user password: - MYSQL_ROOT_PASSWORD - MYSQL_ALLOW_EMPTY_PASSWORD - MYSQL_RANDOM_ROOT_PASSWORD From b11f06b0d202e7b0f97b000e158fc4fc869d2194 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 19 Apr 2021 09:15:19 -0700 Subject: [PATCH 156/285] Update 5.7 to 5.7.34, debian 5.7.34-1debian10 --- 5.7/Dockerfile.debian | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 531b9039e..b580200f0 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.33-1debian10 +ENV MYSQL_VERSION 5.7.34-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index 6b1940a62..bd726e01f 100644 --- a/versions.json +++ b/versions.json @@ -15,9 +15,9 @@ "amd64" ], "suite": "buster", - "version": "5.7.33-1debian10" + "version": "5.7.34-1debian10" }, - "version": "5.7.33" + "version": "5.7.34" }, "8.0": { "debian": { From 919d1ce067be67fbeb1ff43e82c0a3153160ca28 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 19 Apr 2021 09:17:48 -0700 Subject: [PATCH 157/285] Update 8.0 to 8.0.24, debian 8.0.24-1debian10 --- 8.0/Dockerfile.debian | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 5977fffd3..982cf07f5 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.23-1debian10 +ENV MYSQL_VERSION 8.0.24-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index bd726e01f..796aea98f 100644 --- a/versions.json +++ b/versions.json @@ -25,8 +25,8 @@ "amd64" ], "suite": "buster", - "version": "8.0.23-1debian10" + "version": "8.0.24-1debian10" }, - "version": "8.0.23" + "version": "8.0.24" } } From a09a716a88ce34a17e16df3f8b091066d90e6f34 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 10 May 2021 15:15:24 -0700 Subject: [PATCH 158/285] Update 8.0 to 8.0.25, debian 8.0.25-1debian10 --- 8.0/Dockerfile.debian | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 982cf07f5..b401da61f 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.24-1debian10 +ENV MYSQL_VERSION 8.0.25-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index 796aea98f..c6d705839 100644 --- a/versions.json +++ b/versions.json @@ -25,8 +25,8 @@ "amd64" ], "suite": "buster", - "version": "8.0.24-1debian10" + "version": "8.0.25-1debian10" }, - "version": "8.0.24" + "version": "8.0.25" } } From d60655b1b42f677c315d5fe2ca0e87126ca921f5 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 22 Jun 2021 13:57:51 -0700 Subject: [PATCH 159/285] Switch from SKS to Ubuntu keyserver See also https://github.com/docker-library/faq#openpgp--gnupg-keys-and-verification and https://github.com/tianon/pgp-happy-eyeballs --- 5.6/Dockerfile.debian | 2 +- 5.7/Dockerfile.debian | 2 +- 8.0/Dockerfile.debian | 2 +- template/Dockerfile.debian | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/5.6/Dockerfile.debian b/5.6/Dockerfile.debian index 87570ebe7..87a0842e4 100644 --- a/5.6/Dockerfile.debian +++ b/5.6/Dockerfile.debian @@ -53,7 +53,7 @@ RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ gpgconf --kill all; \ rm -rf "$GNUPGHOME"; \ diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index b580200f0..c39dea2be 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -55,7 +55,7 @@ RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ gpgconf --kill all; \ rm -rf "$GNUPGHOME"; \ diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index b401da61f..1eb2eefbe 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -55,7 +55,7 @@ RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ gpgconf --kill all; \ rm -rf "$GNUPGHOME"; \ diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index 092cc57e0..f3eef6203 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -53,7 +53,7 @@ RUN set -ex; \ # gpg: key 5072E1F5: public key "MySQL Release Engineering " imported key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ gpgconf --kill all; \ rm -rf "$GNUPGHOME"; \ From 9e91c13e4147ab680e620d06fb16b505d6ea6bd1 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 19 Jul 2021 10:17:41 -0700 Subject: [PATCH 160/285] Update 5.7 to 5.7.35, debian 5.7.35-1debian10 --- 5.7/Dockerfile.debian | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index c39dea2be..370db0076 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.34-1debian10 +ENV MYSQL_VERSION 5.7.35-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index c6d705839..d1ffd89cb 100644 --- a/versions.json +++ b/versions.json @@ -15,9 +15,9 @@ "amd64" ], "suite": "buster", - "version": "5.7.34-1debian10" + "version": "5.7.35-1debian10" }, - "version": "5.7.34" + "version": "5.7.35" }, "8.0": { "debian": { From c506174eab8ae160f56483e8d72410f8f1e1470f Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 19 Jul 2021 10:31:14 -0700 Subject: [PATCH 161/285] Update 8.0 to 8.0.26, debian 8.0.26-1debian10 --- 8.0/Dockerfile.debian | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 1eb2eefbe..d241bdb04 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.25-1debian10 +ENV MYSQL_VERSION 8.0.26-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index d1ffd89cb..dd2f28932 100644 --- a/versions.json +++ b/versions.json @@ -25,8 +25,8 @@ "amd64" ], "suite": "buster", - "version": "8.0.25-1debian10" + "version": "8.0.26-1debian10" }, - "version": "8.0.25" + "version": "8.0.26" } } From bdf0905b75bc9f7d91cedd859476af8d7629e539 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 18 Oct 2021 09:15:20 -0700 Subject: [PATCH 162/285] Update 5.7 to 5.7.36, debian 5.7.36-1debian10 --- 5.7/Dockerfile.debian | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 370db0076..c07c6ece0 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.35-1debian10 +ENV MYSQL_VERSION 5.7.36-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index dd2f28932..03f0a893d 100644 --- a/versions.json +++ b/versions.json @@ -15,9 +15,9 @@ "amd64" ], "suite": "buster", - "version": "5.7.35-1debian10" + "version": "5.7.36-1debian10" }, - "version": "5.7.35" + "version": "5.7.36" }, "8.0": { "debian": { From 15fe7357b165ee8aaa3ce165386f910a53a75087 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 18 Oct 2021 09:17:48 -0700 Subject: [PATCH 163/285] Update 8.0 to 8.0.27, debian 8.0.27-1debian10 --- 8.0/Dockerfile.debian | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index d241bdb04..12590ff9e 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.26-1debian10 +ENV MYSQL_VERSION 8.0.27-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index 03f0a893d..c2c02db5d 100644 --- a/versions.json +++ b/versions.json @@ -25,8 +25,8 @@ "amd64" ], "suite": "buster", - "version": "8.0.26-1debian10" + "version": "8.0.27-1debian10" }, - "version": "8.0.26" + "version": "8.0.27" } } From 4207addf523258d96f27056cd960b44e77873340 Mon Sep 17 00:00:00 2001 From: daniel sutton Date: Sun, 14 Nov 2021 23:18:59 +0000 Subject: [PATCH 164/285] update GOSU to 1.14 Signed-off-by: daniel sutton --- 5.6/Dockerfile.debian | 2 +- 5.7/Dockerfile.debian | 2 +- 8.0/Dockerfile.debian | 2 +- template/Dockerfile.debian | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/5.6/Dockerfile.debian b/5.6/Dockerfile.debian index 87a0842e4..901ecc06f 100644 --- a/5.6/Dockerfile.debian +++ b/5.6/Dockerfile.debian @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr & # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.12 +ENV GOSU_VERSION 1.14 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index c07c6ece0..531cacb8f 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr & # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.12 +ENV GOSU_VERSION 1.14 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 12590ff9e..afb88c771 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr & # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.12 +ENV GOSU_VERSION 1.14 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index f3eef6203..1e23aab7d 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr & # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.12 +ENV GOSU_VERSION 1.14 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ From 2fc734943d18dbc432ecc9e4c95c367b4a4c5b11 Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 17 Jan 2022 11:13:56 +0100 Subject: [PATCH 165/285] Update to new MySQL GPG Key --- template/Dockerfile.debian | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index 1e23aab7d..77a1d77b6 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -50,8 +50,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* RUN set -ex; \ -# gpg: key 5072E1F5: public key "MySQL Release Engineering " imported - key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ +# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported + key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ From e0359cce8ac0827dae31c4c3c78431156a05cb6d Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Mon, 17 Jan 2022 12:39:27 +0100 Subject: [PATCH 166/285] Apply template changes --- 5.6/Dockerfile.debian | 4 ++-- 5.7/Dockerfile.debian | 4 ++-- 8.0/Dockerfile.debian | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/5.6/Dockerfile.debian b/5.6/Dockerfile.debian index 901ecc06f..9f2226f85 100644 --- a/5.6/Dockerfile.debian +++ b/5.6/Dockerfile.debian @@ -50,8 +50,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* RUN set -ex; \ -# gpg: key 5072E1F5: public key "MySQL Release Engineering " imported - key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ +# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported + key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 531cacb8f..4977ccc44 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -52,8 +52,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* RUN set -ex; \ -# gpg: key 5072E1F5: public key "MySQL Release Engineering " imported - key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ +# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported + key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index afb88c771..dee2a21d9 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -52,8 +52,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* RUN set -ex; \ -# gpg: key 5072E1F5: public key "MySQL Release Engineering " imported - key='A4A9406876FCBD3C456770C88C718D3B5072E1F5'; \ +# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported + key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ From 25b68c6c778cc82db37e6e9825467fbdc53d13ab Mon Sep 17 00:00:00 2001 From: Lars Tangvald Date: Tue, 18 Jan 2022 13:44:26 +0100 Subject: [PATCH 167/285] Update server versions Since the key change is part of the regular release, we need to up the version to 5.7.37 and 8.0.28 --- 5.7/Dockerfile.debian | 2 +- 8.0/Dockerfile.debian | 2 +- versions.json | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 4977ccc44..170e10730 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.36-1debian10 +ENV MYSQL_VERSION 5.7.37-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index dee2a21d9..18912ef4e 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -ex; \ apt-key list > /dev/null ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.27-1debian10 +ENV MYSQL_VERSION 8.0.28-1debian10 RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/versions.json b/versions.json index c2c02db5d..2db79167f 100644 --- a/versions.json +++ b/versions.json @@ -15,9 +15,9 @@ "amd64" ], "suite": "buster", - "version": "5.7.36-1debian10" + "version": "5.7.37-1debian10" }, - "version": "5.7.36" + "version": "5.7.37" }, "8.0": { "debian": { @@ -25,8 +25,8 @@ "amd64" ], "suite": "buster", - "version": "8.0.27-1debian10" + "version": "8.0.28-1debian10" }, - "version": "8.0.27" + "version": "8.0.28" } } From aa600026fe54b1fa6b2a7ac80ffbb466618fcabf Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 18 Jan 2022 09:53:45 -0800 Subject: [PATCH 168/285] Remove EOL 5.6 --- 5.6/Dockerfile.debian | 97 -------- 5.6/docker-entrypoint.sh | 415 ---------------------------------- 5.7/docker-entrypoint.sh | 31 +-- 8.0/docker-entrypoint.sh | 31 +-- template/Dockerfile.debian | 12 +- template/docker-entrypoint.sh | 31 +-- versions.json | 10 - versions.sh | 2 +- 8 files changed, 21 insertions(+), 608 deletions(-) delete mode 100644 5.6/Dockerfile.debian delete mode 100755 5.6/docker-entrypoint.sh diff --git a/5.6/Dockerfile.debian b/5.6/Dockerfile.debian deleted file mode 100644 index 9f2226f85..000000000 --- a/5.6/Dockerfile.debian +++ /dev/null @@ -1,97 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:stretch-slim - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN groupadd -r mysql && useradd -r -g mysql mysql - -RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* - -# add gosu for easy step-down from root -# https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.14 -RUN set -eux; \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends ca-certificates wget; \ - rm -rf /var/lib/apt/lists/*; \ - dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ - wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ - wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ - gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - chmod +x /usr/local/bin/gosu; \ - gosu --version; \ - gosu nobody true - -RUN mkdir /docker-entrypoint-initdb.d - -RUN apt-get update && apt-get install -y --no-install-recommends \ -# for MYSQL_RANDOM_ROOT_PASSWORD - pwgen \ -# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: -# File::Basename -# File::Copy -# Sys::Hostname -# Data::Dumper - perl \ -# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files - xz-utils \ - && rm -rf /var/lib/apt/lists/* - -RUN set -ex; \ -# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported - key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - apt-key list > /dev/null - -ENV MYSQL_MAJOR 5.6 -ENV MYSQL_VERSION 5.6.51-1debian9 - -RUN echo 'deb http://repo.mysql.com/apt/debian/ stretch mysql-5.6' > /etc/apt/sources.list.d/mysql.list - -# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) -# also, we set debconf keys to make APT a little quieter -RUN { \ - echo mysql-community-server mysql-community-server/data-dir select ''; \ - echo mysql-community-server mysql-community-server/root-pass password ''; \ - echo mysql-community-server mysql-community-server/re-root-pass password ''; \ - echo mysql-community-server mysql-community-server/remove-test-db select false; \ - } | debconf-set-selections \ - && apt-get update \ - && apt-get install -y \ - mysql-server="${MYSQL_VERSION}" \ -# comment out a few problematic configuration values - && find /etc/mysql/ -name '*.cnf' -print0 \ - | xargs -0 grep -lZE '^(bind-address|log)' \ - | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \ -# don't reverse lookup hostnames, they are usually another container - && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ - && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 1777 /var/run/mysqld /var/lib/mysql - -VOLUME /var/lib/mysql - -COPY docker-entrypoint.sh /usr/local/bin/ -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -EXPOSE 3306 -CMD ["mysqld"] diff --git a/5.6/docker-entrypoint.sh b/5.6/docker-entrypoint.sh deleted file mode 100755 index 779aa3621..000000000 --- a/5.6/docker-entrypoint.sh +++ /dev/null @@ -1,415 +0,0 @@ -#!/bin/bash -set -eo pipefail -shopt -s nullglob - -# logging functions -mysql_log() { - local type="$1"; shift - # accept argument string or stdin - local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi - local dt; dt="$(date --rfc-3339=seconds)" - printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text" -} -mysql_note() { - mysql_log Note "$@" -} -mysql_warn() { - mysql_log Warn "$@" >&2 -} -mysql_error() { - mysql_log ERROR "$@" >&2 - exit 1 -} - -# usage: file_env VAR [DEFAULT] -# ie: file_env 'XYZ_DB_PASSWORD' 'example' -# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of -# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) -file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - mysql_error "Both $var and $fileVar are set (but are exclusive)" - fi - local val="$def" - if [ "${!var:-}" ]; then - val="${!var}" - elif [ "${!fileVar:-}" ]; then - val="$(< "${!fileVar}")" - fi - export "$var"="$val" - unset "$fileVar" -} - -# check to see if this file is being run or sourced from another script -_is_sourced() { - # https://unix.stackexchange.com/a/215279 - [ "${#FUNCNAME[@]}" -ge 2 ] \ - && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ - && [ "${FUNCNAME[1]}" = 'source' ] -} - -# usage: docker_process_init_files [file [file [...]]] -# ie: docker_process_init_files /always-initdb.d/* -# process initializer files, based on file extensions -docker_process_init_files() { - # mysql here for backwards compatibility "${mysql[@]}" - mysql=( docker_process_sql ) - - echo - local f - for f; do - case "$f" in - *.sh) - # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 - # https://github.com/docker-library/postgres/pull/452 - if [ -x "$f" ]; then - mysql_note "$0: running $f" - "$f" - else - mysql_note "$0: sourcing $f" - . "$f" - fi - ;; - *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; - *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; - *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; - *) mysql_warn "$0: ignoring $f" ;; - esac - echo - done -} - -# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) -_verboseHelpArgs=( - --verbose --help - --log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136 -) - -mysql_check_config() { - local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors - if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" - fi -} - -# Fetch value from server config -# We use mysqld --verbose --help instead of my_print_defaults because the -# latter only show values present in config files, and not server defaults -mysql_get_config() { - local conf="$1"; shift - "$@" "${_verboseHelpArgs[@]}" 2>/dev/null \ - | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' - # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" -} - -# Do a temporary startup of the MySQL server, for init purposes -docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then - "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & - mysql_note "Waiting for server startup" - local i - for i in {30..0}; do - # only use the root password if the database has already been initialized - # so that it won't try to fill in a password file when it hasn't been set yet - extraArgs=() - if [ -z "$DATABASE_ALREADY_EXISTS" ]; then - extraArgs+=( '--dont-use-mysql-root-password' ) - fi - if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then - break - fi - sleep 1 - done - if [ "$i" = 0 ]; then - mysql_error "Unable to start server." - fi - else - # For 5.7+ the server is ready for use as soon as startup command unblocks - if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then - mysql_error "Unable to start server." - fi - fi -} - -# Stop the server. When using a local socket file mysqladmin will block until -# the shutdown is complete. -docker_temp_server_stop() { - if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then - mysql_error "Unable to shut down server." - fi -} - -# Verify that the minimally required password settings are set for new databases. -docker_verify_minimum_env() { - if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error <<-'EOF' - Database is uninitialized and password option is not specified - You need to specify one of the following: - - MYSQL_ROOT_PASSWORD - - MYSQL_ALLOW_EMPTY_PASSWORD - - MYSQL_RANDOM_ROOT_PASSWORD - EOF - fi - - # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) - if [ "$MYSQL_USER" = 'root' ]; then - mysql_error <<-'EOF' - MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user - Remove MYSQL_USER="root" and use one of the following to control the root user password: - - MYSQL_ROOT_PASSWORD - - MYSQL_ALLOW_EMPTY_PASSWORD - - MYSQL_RANDOM_ROOT_PASSWORD - EOF - fi - - # warn when missing one of MYSQL_USER or MYSQL_PASSWORD - if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then - mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created' - elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then - mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored' - fi -} - -# creates folders for the database -# also ensures permission for user mysql of run as root -docker_create_db_directories() { - local user; user="$(id -u)" - - # TODO other directories that are used by default? like /var/lib/mysql-files - # see https://github.com/docker-library/mysql/issues/562 - mkdir -p "$DATADIR" - - if [ "$user" = "0" ]; then - # this will cause less disk access than `chown -R` - find "$DATADIR" \! -user mysql -exec chown mysql '{}' + - fi -} - -# initializes the database directory -docker_init_database_dir() { - mysql_note "Initializing database files" - if [ "$MYSQL_MAJOR" = '5.6' ]; then - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" --default-time-zone=SYSTEM - else - "$@" --initialize-insecure --default-time-zone=SYSTEM - fi - mysql_note "Database files initialized" - - if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then - # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - mysql_note "Initializing certificates" - mysql_ssl_rsa_setup --datadir="$DATADIR" - mysql_note "Certificates initialized" - fi -} - -# Loads various settings that are used elsewhere in the script -# This should be called after mysql_check_config, but before any other functions -docker_setup_env() { - # Get config - declare -g DATADIR SOCKET - DATADIR="$(mysql_get_config 'datadir' "$@")" - SOCKET="$(mysql_get_config 'socket' "$@")" - - # Initialize values that might be stored in a file - file_env 'MYSQL_ROOT_HOST' '%' - file_env 'MYSQL_DATABASE' - file_env 'MYSQL_USER' - file_env 'MYSQL_PASSWORD' - file_env 'MYSQL_ROOT_PASSWORD' - - declare -g DATABASE_ALREADY_EXISTS - if [ -d "$DATADIR/mysql" ]; then - DATABASE_ALREADY_EXISTS='true' - fi -} - -# Execute sql script, passed via stdin -# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args] -# ie: docker_process_sql --database=mydb <<<'INSERT ...' -# ie: docker_process_sql --dont-use-mysql-root-password --database=mydb /dev/null - - docker_init_database_dir "$@" - - mysql_note "Starting temporary server" - docker_temp_server_start "$@" - mysql_note "Temporary server started." - - docker_setup_db - docker_process_init_files /docker-entrypoint-initdb.d/* - - mysql_expire_root_user - - mysql_note "Stopping temporary server" - docker_temp_server_stop - mysql_note "Temporary server stopped" - - echo - mysql_note "MySQL init process done. Ready for start up." - echo - fi - fi - exec "$@" -} - -# If we are sourced from elsewhere, don't perform any further actions -if ! _is_sourced; then - _main "$@" -fi diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 779aa3621..761da5349 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -106,7 +106,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then + if [ "${MYSQL_MAJOR}" = '5.7' ]; then "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i @@ -190,11 +190,7 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - if [ "$MYSQL_MAJOR" = '5.6' ]; then - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" --default-time-zone=SYSTEM - else - "$@" --initialize-insecure --default-time-zone=SYSTEM - fi + "$@" --initialize-insecure --default-time-zone=SYSTEM mysql_note "Database files initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then @@ -272,25 +268,10 @@ docker_setup_db() { fi local passwordSet= - if [ "$MYSQL_MAJOR" = '5.6' ]; then - # no, we don't care if read finds a terminating character in this heredoc (see above) - read -r -d '' passwordSet <<-EOSQL || true - DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; - SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; - - -- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210 - -- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236 - -- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818 - -- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749 - DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ; - -- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6") - EOSQL - else - # no, we don't care if read finds a terminating character in this heredoc (see above) - read -r -d '' passwordSet <<-EOSQL || true - ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - EOSQL - fi + # no, we don't care if read finds a terminating character in this heredoc (see above) + read -r -d '' passwordSet <<-EOSQL || true + ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + EOSQL # tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is just now being set docker_process_sql --dont-use-mysql-root-password --database=mysql <<-EOSQL diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 779aa3621..761da5349 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -106,7 +106,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then + if [ "${MYSQL_MAJOR}" = '5.7' ]; then "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i @@ -190,11 +190,7 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - if [ "$MYSQL_MAJOR" = '5.6' ]; then - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" --default-time-zone=SYSTEM - else - "$@" --initialize-insecure --default-time-zone=SYSTEM - fi + "$@" --initialize-insecure --default-time-zone=SYSTEM mysql_note "Database files initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then @@ -272,25 +268,10 @@ docker_setup_db() { fi local passwordSet= - if [ "$MYSQL_MAJOR" = '5.6' ]; then - # no, we don't care if read finds a terminating character in this heredoc (see above) - read -r -d '' passwordSet <<-EOSQL || true - DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; - SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; - - -- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210 - -- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236 - -- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818 - -- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749 - DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ; - -- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6") - EOSQL - else - # no, we don't care if read finds a terminating character in this heredoc (see above) - read -r -d '' passwordSet <<-EOSQL || true - ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - EOSQL - fi + # no, we don't care if read finds a terminating character in this heredoc (see above) + read -r -d '' passwordSet <<-EOSQL || true + ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + EOSQL # tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is just now being set docker_process_sql --dont-use-mysql-root-password --database=mysql <<-EOSQL diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index 77a1d77b6..a8602095b 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -33,12 +33,8 @@ RUN mkdir /docker-entrypoint-initdb.d RUN apt-get update && apt-get install -y --no-install-recommends \ # for MYSQL_RANDOM_ROOT_PASSWORD pwgen \ -{{ - if env.version != "5.6" then ( --}} # for mysql_ssl_rsa_setup openssl \ -{{ ) else "" end -}} # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename # File::Copy @@ -74,7 +70,7 @@ RUN { \ } | debconf-set-selections \ && apt-get update \ && apt-get install -y \ -{{ if env.version == "5.6" or env.version == "5.7" then ( -}} +{{ if env.version == "5.7" then ( -}} mysql-server="${MYSQL_VERSION}" \ # comment out a few problematic configuration values && find /etc/mysql/ -name '*.cnf' -print0 \ @@ -94,7 +90,7 @@ RUN { \ VOLUME /var/lib/mysql -{{ if env.version != "5.6" and env.version != "5.7" then ( -}} +{{ if env.version != "5.7" then ( -}} # Config files COPY config/ /etc/mysql/ {{ ) else "" end -}} @@ -102,9 +98,5 @@ COPY docker-entrypoint.sh /usr/local/bin/ RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] -{{ if env.version != "5.6" then ( -}} EXPOSE 3306 33060 -{{ ) else ( -}} -EXPOSE 3306 -{{ ) end -}} CMD ["mysqld"] diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index 779aa3621..761da5349 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -106,7 +106,7 @@ mysql_get_config() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.6' ] || [ "${MYSQL_MAJOR}" = '5.7' ]; then + if [ "${MYSQL_MAJOR}" = '5.7' ]; then "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & mysql_note "Waiting for server startup" local i @@ -190,11 +190,7 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - if [ "$MYSQL_MAJOR" = '5.6' ]; then - mysql_install_db --datadir="$DATADIR" --rpm --keep-my-cnf "${@:2}" --default-time-zone=SYSTEM - else - "$@" --initialize-insecure --default-time-zone=SYSTEM - fi + "$@" --initialize-insecure --default-time-zone=SYSTEM mysql_note "Database files initialized" if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then @@ -272,25 +268,10 @@ docker_setup_db() { fi local passwordSet= - if [ "$MYSQL_MAJOR" = '5.6' ]; then - # no, we don't care if read finds a terminating character in this heredoc (see above) - read -r -d '' passwordSet <<-EOSQL || true - DELETE FROM mysql.user WHERE user NOT IN ('mysql.sys', 'mysqlxsys', 'root') OR host NOT IN ('localhost') ; - SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MYSQL_ROOT_PASSWORD}') ; - - -- 5.5: https://github.com/mysql/mysql-server/blob/e48d775c6f066add457fa8cfb2ebc4d5ff0c7613/scripts/mysql_secure_installation.sh#L192-L210 - -- 5.6: https://github.com/mysql/mysql-server/blob/06bc670db0c0e45b3ea11409382a5c315961f682/scripts/mysql_secure_installation.sh#L218-L236 - -- 5.7: https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/client/mysql_secure_installation.cc#L792-L818 - -- 8.0: https://github.com/mysql/mysql-server/blob/b93c1661d689c8b7decc7563ba15f6ed140a4eb6/client/mysql_secure_installation.cc#L726-L749 - DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' ; - -- https://github.com/docker-library/mysql/pull/479#issuecomment-414561272 ("This is only needed for 5.5 and 5.6") - EOSQL - else - # no, we don't care if read finds a terminating character in this heredoc (see above) - read -r -d '' passwordSet <<-EOSQL || true - ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; - EOSQL - fi + # no, we don't care if read finds a terminating character in this heredoc (see above) + read -r -d '' passwordSet <<-EOSQL || true + ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; + EOSQL # tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is just now being set docker_process_sql --dont-use-mysql-root-password --database=mysql <<-EOSQL diff --git a/versions.json b/versions.json index 2db79167f..4f787cb5a 100644 --- a/versions.json +++ b/versions.json @@ -1,14 +1,4 @@ { - "5.6": { - "debian": { - "architectures": [ - "amd64" - ], - "suite": "stretch", - "version": "5.6.51-1debian9" - }, - "version": "5.6.51" - }, "5.7": { "debian": { "architectures": [ diff --git a/versions.sh b/versions.sh index e475d0b78..a9b951e5d 100755 --- a/versions.sh +++ b/versions.sh @@ -3,7 +3,7 @@ set -Eeuo pipefail defaultDebianSuite='buster' declare -A debianSuites=( - [5.6]='stretch' + #[5.6]='stretch' ) cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" From 0bd6d4c0c8b437241e62a3798d47724f33ec2c89 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 11 Feb 2022 10:31:07 -0800 Subject: [PATCH 169/285] Fix .gitattributes --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index dfa02cc85..f5f31a4d1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,3 @@ /*.*/**/Dockerfile* linguist-generated /*.*/**/docker-entrypoint.sh linguist-generated -Dockerfile* linguist-language=Dockerfile +/template/Dockerfile* linguist-language=Dockerfile From 4afbe061ef1dc5f5fea3971ad9fcf8f0c796b91c Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 11 Feb 2022 10:36:16 -0800 Subject: [PATCH 170/285] Switch from apt-key/trusted.gpg(.d) to signed-by --- 5.7/Dockerfile.debian | 8 ++++---- 8.0/Dockerfile.debian | 8 ++++---- template/Dockerfile.debian | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 170e10730..e206506dd 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -56,15 +56,15 @@ RUN set -ex; \ key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + mkdir -p /etc/apt/keyrings; \ + gpg --batch --export "$key" > /etc/apt/keyrings/mysql.gpg; \ gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - apt-key list > /dev/null + rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 ENV MYSQL_VERSION 5.7.37-1debian10 -RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list +RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 18912ef4e..a00985002 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -56,15 +56,15 @@ RUN set -ex; \ key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + mkdir -p /etc/apt/keyrings; \ + gpg --batch --export "$key" > /etc/apt/keyrings/mysql.gpg; \ gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - apt-key list > /dev/null + rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 ENV MYSQL_VERSION 8.0.28-1debian10 -RUN echo 'deb http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list +RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index a8602095b..c4d12156a 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -50,15 +50,15 @@ RUN set -ex; \ key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - gpg --batch --export "$key" > /etc/apt/trusted.gpg.d/mysql.gpg; \ + mkdir -p /etc/apt/keyrings; \ + gpg --batch --export "$key" > /etc/apt/keyrings/mysql.gpg; \ gpgconf --kill all; \ - rm -rf "$GNUPGHOME"; \ - apt-key list > /dev/null + rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR {{ env.version }} ENV MYSQL_VERSION {{ .debian.version }} -RUN echo 'deb http://repo.mysql.com/apt/debian/ {{ .debian.suite }} mysql-{{ env.version }}' > /etc/apt/sources.list.d/mysql.list +RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ {{ .debian.suite }} mysql-{{ env.version }}' > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter From 2d86ed268c0dcacb38d9a39daf7686a9d9d61400 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 16 May 2018 11:24:29 -0700 Subject: [PATCH 171/285] Drop explicit "mysql_ssl_rsa_setup" invocation > I _think_ the separate mysql_ssl_rsa_setup utility was mostly just relevant before we started linking openssl (for licensing issues), so this may no longer be needed for any versions? Also, this behavior can be controlled with the auto_generate_certs and sha256_password_auto_generate_rsa_keys settings. So by virtue of me being over 2 years late *cough*, I think this probably isn't needed any more :) --- 5.7/docker-entrypoint.sh | 7 ------- 8.0/docker-entrypoint.sh | 7 ------- template/docker-entrypoint.sh | 7 ------- 3 files changed, 21 deletions(-) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 761da5349..f4e6c865b 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -192,13 +192,6 @@ docker_init_database_dir() { mysql_note "Initializing database files" "$@" --initialize-insecure --default-time-zone=SYSTEM mysql_note "Database files initialized" - - if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then - # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - mysql_note "Initializing certificates" - mysql_ssl_rsa_setup --datadir="$DATADIR" - mysql_note "Certificates initialized" - fi } # Loads various settings that are used elsewhere in the script diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 761da5349..f4e6c865b 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -192,13 +192,6 @@ docker_init_database_dir() { mysql_note "Initializing database files" "$@" --initialize-insecure --default-time-zone=SYSTEM mysql_note "Database files initialized" - - if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then - # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - mysql_note "Initializing certificates" - mysql_ssl_rsa_setup --datadir="$DATADIR" - mysql_note "Certificates initialized" - fi } # Loads various settings that are used elsewhere in the script diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index 761da5349..f4e6c865b 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -192,13 +192,6 @@ docker_init_database_dir() { mysql_note "Initializing database files" "$@" --initialize-insecure --default-time-zone=SYSTEM mysql_note "Database files initialized" - - if command -v mysql_ssl_rsa_setup > /dev/null && [ ! -e "$DATADIR/server-key.pem" ]; then - # https://github.com/mysql/mysql-server/blob/23032807537d8dd8ee4ec1c4d40f0633cd4e12f9/packaging/deb-in/extra/mysql-systemd-start#L81-L84 - mysql_note "Initializing certificates" - mysql_ssl_rsa_setup --datadir="$DATADIR" - mysql_note "Certificates initialized" - fi } # Loads various settings that are used elsewhere in the script From c77f72025a5523a86102fe45524ca6f9b66306c4 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 28 May 2020 16:47:07 -0700 Subject: [PATCH 172/285] Add Oracle Linux image variants The primary benefits of this are arm64 support (in 8.0) and smaller images (in 5.7 and 8.0). ```console $ docker images mysql --format 'table {{ .Tag }}\t{{ .Size }}' | sort -rV TAG SIZE 8.0-oracle 431MB 8.0-debian 519MB 5.7-oracle 395MB 5.7-debian 448MB ``` --- 5.7/Dockerfile.oracle | 108 +++++++++++++++++++++++++ 8.0/Dockerfile.oracle | 111 ++++++++++++++++++++++++++ apply-templates.sh | 21 ++--- generate-stackbrew-library.sh | 39 ++++++--- template/Dockerfile.oracle | 108 +++++++++++++++++++++++++ versions.json | 21 +++++ versions.sh | 144 +++++++++++++++++++++++++++------- 7 files changed, 505 insertions(+), 47 deletions(-) create mode 100644 5.7/Dockerfile.oracle create mode 100644 8.0/Dockerfile.oracle create mode 100644 template/Dockerfile.oracle diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle new file mode 100644 index 000000000..70abebec1 --- /dev/null +++ b/5.7/Dockerfile.oracle @@ -0,0 +1,108 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM oraclelinux:7-slim + +RUN set -eux; \ + groupadd --system --gid 999 mysql; \ + useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql; \ + \ + mkdir /var/lib/mysql /var/run/mysqld; \ + chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + chmod 1777 /var/lib/mysql /var/run/mysqld; \ + \ + mkdir /docker-entrypoint-initdb.d + +# add gosu for easy step-down from root +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.12 +RUN set -eux; \ +# TODO find a better userspace architecture detection method than querying the kernel + arch="$(uname -m)"; \ + case "$arch" in \ + aarch64) gosuArch='arm64' ;; \ + x86_64) gosuArch='amd64' ;; \ + *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ + esac; \ + curl -fL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch.asc"; \ + curl -fL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true + +RUN set -eux; \ +# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html +# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported + key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ + rm -rf "$GNUPGHOME" + +ENV MYSQL_MAJOR 5.7 +ENV MYSQL_VERSION 5.7.37-1.el7 + +RUN set -eu; \ + . /etc/os-release; \ + { \ + echo '[mysql5.7-server-minimal]'; \ + echo 'name=MySQL 5.7 Server Minimal'; \ + echo 'enabled=1'; \ + echo "baseurl=https://repo.mysql.com/yum/mysql-5.7-community/docker/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-minimal.repo + +RUN set -eux; \ + yum install -y "mysql-community-server-minimal-$MYSQL_VERSION"; \ + yum clean all; \ +# the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead) +# https://github.com/docker-library/mysql/pull/680#issuecomment-636121520 + grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ + sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ + grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ + \ +# make sure users dumping files in "/etc/mysql/conf.d" still works + ! grep -F '!includedir' /etc/my.cnf; \ + { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ + mkdir -p /etc/mysql/conf.d; \ + \ + mysqld --version; \ + mysql --version + +RUN set -eu; \ + . /etc/os-release; \ + { \ + echo '[mysql-tools-community]'; \ + echo 'name=MySQL Tools Community'; \ + echo "baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'enabled=1'; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-tools.repo +ENV MYSQL_SHELL_VERSION 8.0.28-1.el7 +RUN set -eux; \ + yum install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ + yum clean all; \ + \ + mysqlsh --version + +VOLUME /var/lib/mysql + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 3306 33060 +CMD ["mysqld"] diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle new file mode 100644 index 000000000..b9c2a013f --- /dev/null +++ b/8.0/Dockerfile.oracle @@ -0,0 +1,111 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM oraclelinux:8-slim + +RUN set -eux; \ + groupadd --system --gid 999 mysql; \ + useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql; \ + \ + mkdir /var/lib/mysql /var/run/mysqld; \ + chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + chmod 1777 /var/lib/mysql /var/run/mysqld; \ + \ + mkdir /docker-entrypoint-initdb.d + +# add gosu for easy step-down from root +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.12 +RUN set -eux; \ +# TODO find a better userspace architecture detection method than querying the kernel + arch="$(uname -m)"; \ + case "$arch" in \ + aarch64) gosuArch='arm64' ;; \ + x86_64) gosuArch='amd64' ;; \ + *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ + esac; \ + curl -fL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch.asc"; \ + curl -fL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true + +RUN set -eux; \ +# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html +# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported + key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ + rm -rf "$GNUPGHOME" + +# Oracle Linux 8+ is very slim :) +RUN set -eux; microdnf install -y findutils; microdnf clean all + +ENV MYSQL_MAJOR 8.0 +ENV MYSQL_VERSION 8.0.28-1.el8 + +RUN set -eu; \ + . /etc/os-release; \ + { \ + echo '[mysql8.0-server-minimal]'; \ + echo 'name=MySQL 8.0 Server Minimal'; \ + echo 'enabled=1'; \ + echo "baseurl=https://repo.mysql.com/yum/mysql-8.0-community/docker/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-minimal.repo + +RUN set -eux; \ + microdnf install -y "mysql-community-server-minimal-$MYSQL_VERSION"; \ + microdnf clean all; \ +# the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead) +# https://github.com/docker-library/mysql/pull/680#issuecomment-636121520 + grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ + sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ + grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ + \ +# make sure users dumping files in "/etc/mysql/conf.d" still works + ! grep -F '!includedir' /etc/my.cnf; \ + { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ + mkdir -p /etc/mysql/conf.d; \ + \ + mysqld --version; \ + mysql --version + +RUN set -eu; \ + . /etc/os-release; \ + { \ + echo '[mysql-tools-community]'; \ + echo 'name=MySQL Tools Community'; \ + echo "baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'enabled=1'; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-tools.repo +ENV MYSQL_SHELL_VERSION 8.0.28-1.el8 +RUN set -eux; \ + microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ + microdnf clean all; \ + \ + mysqlsh --version + +VOLUME /var/lib/mysql + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 3306 33060 +CMD ["mysqld"] diff --git a/apply-templates.sh b/apply-templates.sh index f80f7670b..59053f54f 100755 --- a/apply-templates.sh +++ b/apply-templates.sh @@ -31,15 +31,18 @@ generated_warning() { for version; do export version - debianVersion="$(jq -r '.[env.version].debian // ""' versions.json)" - if [ -n "$debianVersion" ]; then - dockerfile='Dockerfile.debian' - - { - generated_warning - gawk -f "$jqt" "template/$dockerfile" - } > "$version/$dockerfile" - fi + for variant in oracle debian; do + export variant + + variantVersion="$(jq -r '.[env.version][env.variant] // {} | .version // ""' versions.json)" + if [ -n "$variantVersion" ]; then + dockerfile="Dockerfile.$variant" + { + generated_warning + gawk -f "$jqt" "template/$dockerfile" + } > "$version/$dockerfile" + fi + done cp -a template/docker-entrypoint.sh "$version/docker-entrypoint.sh" done diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index a6940e74a..773ba0fc2 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -6,6 +6,12 @@ declare -A aliases=( [8.0]='8 latest' ) +defaultDefaultVariant='oracle' +declare -A defaultVariants=( + [5.7]='debian' + [8.0]='debian' +) + self="$(basename "$BASH_SOURCE")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" @@ -58,9 +64,8 @@ join() { for version; do export version - df='Dockerfile.debian' - commit="$(dirCommit "$version" "$df")" + defaultVariant="${defaultVariants[$version]:-$defaultDefaultVariant}" fullVersion="$(jq -r '.[env.version].version' versions.json)" versionAliases=() @@ -73,11 +78,27 @@ for version; do ${aliases[$version]:-} ) - echo - cat <<-EOE - Tags: $(join ', ' "${versionAliases[@]}") - GitCommit: $commit - Directory: $version - File: $df - EOE + for variant in oracle debian; do + df="Dockerfile.$variant" + commit="$(dirCommit "$version" "$df")" + + variantAliases=( "${versionAliases[@]/%/-$variant}" ) + variantAliases=( "${variantAliases[@]//latest-/}" ) + if [ "$variant" = "$defaultVariant" ]; then + variantAliases=( "${versionAliases[@]}" "${variantAliases[@]}" ) + fi + + # TODO if the list of architectures supported by MySQL ever is greater than that of the base image it's FROM, this list will need to be filtered + export variant + variantArches="$(jq -r '.[env.version][env.variant].architectures | join(", ")' versions.json)" + + echo + cat <<-EOE + Tags: $(join ', ' "${variantAliases[@]}") + Architectures: $variantArches + GitCommit: $commit + Directory: $version + File: $df + EOE + done done diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle new file mode 100644 index 000000000..cc71facf3 --- /dev/null +++ b/template/Dockerfile.oracle @@ -0,0 +1,108 @@ +{{ def dnf: if .oracle.variant | startswith("7") then "yum" else "microdnf" end -}} +FROM oraclelinux:{{ .oracle.variant }} + +RUN set -eux; \ + groupadd --system --gid 999 mysql; \ + useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql; \ + \ + mkdir /var/lib/mysql /var/run/mysqld; \ + chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + chmod 1777 /var/lib/mysql /var/run/mysqld; \ + \ + mkdir /docker-entrypoint-initdb.d + +# add gosu for easy step-down from root +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.12 +RUN set -eux; \ +# TODO find a better userspace architecture detection method than querying the kernel + arch="$(uname -m)"; \ + case "$arch" in \ + aarch64) gosuArch='arm64' ;; \ + x86_64) gosuArch='amd64' ;; \ + *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ + esac; \ + curl -fL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch.asc"; \ + curl -fL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true + +RUN set -eux; \ +# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html +# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported + key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ + rm -rf "$GNUPGHOME" + +{{ if .oracle.variant | startswith("7") then "" else ( -}} +# Oracle Linux 8+ is very slim :) +RUN set -eux; {{ dnf }} install -y findutils; {{ dnf }} clean all + +{{ ) end -}} +ENV MYSQL_MAJOR {{ env.version }} +ENV MYSQL_VERSION {{ .oracle.version }} + +RUN set -eu; \ + . /etc/os-release; \ + { \ + echo '[mysql{{ env.version }}-server-minimal]'; \ + echo 'name=MySQL {{ env.version }} Server Minimal'; \ + echo 'enabled=1'; \ + echo "baseurl=https://repo.mysql.com/yum/mysql-{{ env.version }}-community/docker/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-minimal.repo + +RUN set -eux; \ + {{ dnf }} install -y "mysql-community-server-minimal-$MYSQL_VERSION"; \ + {{ dnf }} clean all; \ +# the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead) +# https://github.com/docker-library/mysql/pull/680#issuecomment-636121520 + grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ + sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ + grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ + \ +# make sure users dumping files in "/etc/mysql/conf.d" still works + ! grep -F '!includedir' /etc/my.cnf; \ + { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ + mkdir -p /etc/mysql/conf.d; \ + \ + mysqld --version; \ + mysql --version + +RUN set -eu; \ + . /etc/os-release; \ + { \ + echo '[mysql-tools-community]'; \ + echo 'name=MySQL Tools Community'; \ + echo "baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'enabled=1'; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-tools.repo +ENV MYSQL_SHELL_VERSION {{ .["mysql-shell"].version }} +RUN set -eux; \ + {{ dnf }} install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ + {{ dnf }} clean all; \ + \ + mysqlsh --version + +VOLUME /var/lib/mysql + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 3306 33060 +CMD ["mysqld"] diff --git a/versions.json b/versions.json index 4f787cb5a..0c9197b16 100644 --- a/versions.json +++ b/versions.json @@ -7,6 +7,16 @@ "suite": "buster", "version": "5.7.37-1debian10" }, + "mysql-shell": { + "version": "8.0.28-1.el7" + }, + "oracle": { + "architectures": [ + "amd64" + ], + "variant": "7-slim", + "version": "5.7.37-1.el7" + }, "version": "5.7.37" }, "8.0": { @@ -17,6 +27,17 @@ "suite": "buster", "version": "8.0.28-1debian10" }, + "mysql-shell": { + "version": "8.0.28-1.el8" + }, + "oracle": { + "architectures": [ + "amd64", + "arm64v8" + ], + "variant": "8-slim", + "version": "8.0.28-1.el8" + }, "version": "8.0.28" } } diff --git a/versions.sh b/versions.sh index a9b951e5d..4be42f426 100755 --- a/versions.sh +++ b/versions.sh @@ -3,9 +3,32 @@ set -Eeuo pipefail defaultDebianSuite='buster' declare -A debianSuites=( - #[5.6]='stretch' + #[8.0]='stretch' ) +defaultOracleVariant='8-slim' +declare -A oracleVariants=( + [5.7]='7-slim' +) + +# https://repo.mysql.com/yum/mysql-8.0-community/docker/ +declare -A bashbrewArchToRpmArch=( + [amd64]='x86_64' + [arm64v8]='aarch64' +) + +fetch_rpm_versions() { + local repo="$1"; shift + local arch="$1"; shift + local oracleVersion="$1"; shift + local package="$1"; shift + + curl -fsSL "$repo/$arch/" 2>/dev/null \ + | grep -oE '"'"$package"'-[0-9][^"]+[.]el'"$oracleVersion"'[.]'"$arch"'[.]rpm"' \ + | sed -r 's/^"'"$package-|[.]$arch[.]rpm"'"$//g' \ + | sort -rV +} + cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" versions=( "$@" ) @@ -20,36 +43,99 @@ versions=( "${versions[@]%/}" ) for version in "${versions[@]}"; do export version - debianSuite="${debianSuites[$version]:-$defaultDebianSuite}" - debianVersion="$( - curl -fsSL "https://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ - | gunzip \ - | awk -F ': ' ' - $1 == "Package" { - pkg = $2 - next - } - pkg == "mysql-server" && $1 == "Version" { - print $2 + doc='{}' + + if [[ "$version" == 5.* ]] || [ "$version" = '8.0' ]; then + debianSuite="${debianSuites[$version]:-$defaultDebianSuite}" + debianVersion="$( + curl -fsSL "https://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ + | gunzip \ + | awk -F ': ' ' + $1 == "Package" { + pkg = $2 + next + } + pkg == "mysql-server" && $1 == "Version" { + print $2 + } + ' + )" + + # example 8.0.22-1debian10 => 8.0.22 + baseVersion="${debianVersion%-*}" + + export baseVersion debianSuite debianVersion + doc="$( + jq <<<"$doc" -c ' + . += { + version: env.baseVersion, + debian: { + architectures: [ "amd64" ], + suite: env.debianSuite, + version: env.debianVersion, + }, } ' - )" - - # example 8.0.22-1debian10 => 8.0.22 - baseVersion="${debianVersion%-*}" - - export baseVersion debianSuite debianVersion - json="$( - jq <<<"$json" -c \ - '.[env.version] = { - version: env.baseVersion, - debian: { - architectures: [ "amd64" ], - suite: env.debianSuite, - version: env.debianVersion, - }, - }' - )" + )" + fi + + oracleVariant="${oracleVariants[$version]:-$defaultOracleVariant}" + oracleVersion="${oracleVariant%%-*}" # "7", etc + rpmVersion= + shellVersion= + doc="$(jq <<<"$doc" -c '. += { oracle: { architectures: [] } }')" + for bashbrewArch in $(xargs -n1 <<<"${!bashbrewArchToRpmArch[*]}" | sort | xargs); do + rpmArch="${bashbrewArchToRpmArch[$bashbrewArch]}" + rpmRepo="https://repo.mysql.com/yum/mysql-$version-community/docker/el/$oracleVersion" + archVersions="$( + fetch_rpm_versions "$rpmRepo" "$rpmArch" "$oracleVersion" 'mysql-community-server-minimal' \ + | grep -E "^$version[.]" \ + || : + )" + archVersion="$(head -1 <<<"$archVersions")" + [ -n "$archVersion" ] || continue + if [ -z "$rpmVersion" ]; then + rpmVersion="$archVersion" + elif [ "$rpmVersion" != "$archVersion" ]; then + echo >&2 "error: $version architecture version mismatch! ('$rpmVersion' vs '$archVersion' on '$rpmArch'/'$bashbrewArch')" + exit 1 + fi + shellArchVersions="$(fetch_rpm_versions "https://repo.mysql.com/yum/mysql-tools-community/el/$oracleVersion" "$rpmArch" "$oracleVersion" 'mysql-shell')" + shellArchVersion="$(head -1 <<<"$shellArchVersions")" + if [ -z "$shellVersion" ]; then + shellVersion="$shellArchVersion" + elif [ "$shellVersion" != "$shellArchVersion" ]; then + echo >&2 "error: shell version mismatch! ('$shellVersion' vs '$shellArchVersion' on '$rpmArch'/'$bashbrewArch')" + exit 1 + fi + export bashbrewArch + doc="$(jq <<<"$doc" -c '.oracle.architectures = (.oracle.architectures + [ env.bashbrewArch ] | sort)')" + done + baseVersion="$(jq <<<"$doc" -r '.version // ""')" + # example 8.0.22-1.el7 => 8.0.22 + oracleBaseVersion="${rpmVersion%-*}" + : "${baseVersion:=$oracleBaseVersion}" + if [ "$baseVersion" != "$oracleBaseVersion" ]; then + echo >&2 "error: Oracle and Debian version mismatch! ('$oracleBaseVersion' vs '$baseVersion')" + exit 1 + fi + export baseVersion rpmVersion shellVersion oracleVariant + doc="$(jq <<<"$doc" -c ' + . += { + version: env.baseVersion, + oracle: (.oracle + { + version: env.rpmVersion, + variant: env.oracleVariant, + }), + "mysql-shell": { + version: env.shellVersion, + }, + } + ')" + + echo "$version: $baseVersion" + + json="$(jq <<<"$json" -c --argjson doc "$doc" '.[env.version] = $doc')" done jq <<<"$json" -S . > versions.json From 4e7d3969ede713b2660ca04493125c6d714d343f Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 17 Feb 2022 14:11:12 -0800 Subject: [PATCH 173/285] Update Oracle "gosu" to 1.14 --- 5.7/Dockerfile.oracle | 2 +- 8.0/Dockerfile.oracle | 2 +- template/Dockerfile.oracle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 70abebec1..2f60699ec 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -19,7 +19,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.12 +ENV GOSU_VERSION 1.14 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index b9c2a013f..1c617888d 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -19,7 +19,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.12 +ENV GOSU_VERSION 1.14 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index cc71facf3..878cabc21 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -14,7 +14,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.12 +ENV GOSU_VERSION 1.14 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ From 24e6931ec8187930dfad5ef2d205a9874f86ca4c Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 22 Feb 2022 12:32:05 -0800 Subject: [PATCH 174/285] Switch from "pwgen" to "openssl rand" and add missing Oracle deps --- 5.7/Dockerfile.debian | 12 ++++++------ 5.7/Dockerfile.oracle | 7 +++++++ 5.7/docker-entrypoint.sh | 2 +- 8.0/Dockerfile.debian | 12 ++++++------ 8.0/Dockerfile.oracle | 12 +++++++++--- 8.0/docker-entrypoint.sh | 2 +- template/Dockerfile.debian | 12 ++++++------ template/Dockerfile.oracle | 16 +++++++++++----- template/docker-entrypoint.sh | 2 +- 9 files changed, 48 insertions(+), 29 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index e206506dd..7da445782 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -36,10 +36,9 @@ RUN set -eux; \ RUN mkdir /docker-entrypoint-initdb.d -RUN apt-get update && apt-get install -y --no-install-recommends \ -# for MYSQL_RANDOM_ROOT_PASSWORD - pwgen \ -# for mysql_ssl_rsa_setup +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ openssl \ # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename @@ -49,9 +48,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ perl \ # install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files xz-utils \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* -RUN set -ex; \ +RUN set -eux; \ # gpg: key 3A79BD29: public key "MySQL Release Engineering " imported key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ export GNUPGHOME="$(mktemp -d)"; \ diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 2f60699ec..0907775dc 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -38,6 +38,13 @@ RUN set -eux; \ gosu --version; \ gosu nobody true +RUN set -eux; \ + yum install -y \ + gzip \ + xz \ + ; \ + yum clean all + RUN set -eux; \ # https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html # gpg: key 3A79BD29: public key "MySQL Release Engineering " imported diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index f4e6c865b..74d810080 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -245,7 +245,7 @@ docker_setup_db() { fi # Generate random root password if [ -n "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" + MYSQL_ROOT_PASSWORD="$(openssl rand -base64 24)"; export MYSQL_ROOT_PASSWORD mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi # Sets root password and creates root users for non-localhost hosts diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index a00985002..6c308f283 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -36,10 +36,9 @@ RUN set -eux; \ RUN mkdir /docker-entrypoint-initdb.d -RUN apt-get update && apt-get install -y --no-install-recommends \ -# for MYSQL_RANDOM_ROOT_PASSWORD - pwgen \ -# for mysql_ssl_rsa_setup +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ openssl \ # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename @@ -49,9 +48,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ perl \ # install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files xz-utils \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* -RUN set -ex; \ +RUN set -eux; \ # gpg: key 3A79BD29: public key "MySQL Release Engineering " imported key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ export GNUPGHOME="$(mktemp -d)"; \ diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 1c617888d..36be9f734 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -38,6 +38,15 @@ RUN set -eux; \ gosu --version; \ gosu nobody true +RUN set -eux; \ + microdnf install -y \ + gzip \ + xz \ +# Oracle Linux 8+ is very slim :) + findutils \ + ; \ + microdnf clean all + RUN set -eux; \ # https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html # gpg: key 3A79BD29: public key "MySQL Release Engineering " imported @@ -47,9 +56,6 @@ RUN set -eux; \ gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ rm -rf "$GNUPGHOME" -# Oracle Linux 8+ is very slim :) -RUN set -eux; microdnf install -y findutils; microdnf clean all - ENV MYSQL_MAJOR 8.0 ENV MYSQL_VERSION 8.0.28-1.el8 diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index f4e6c865b..74d810080 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -245,7 +245,7 @@ docker_setup_db() { fi # Generate random root password if [ -n "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" + MYSQL_ROOT_PASSWORD="$(openssl rand -base64 24)"; export MYSQL_ROOT_PASSWORD mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi # Sets root password and creates root users for non-localhost hosts diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index c4d12156a..cb4cad805 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -30,10 +30,9 @@ RUN set -eux; \ RUN mkdir /docker-entrypoint-initdb.d -RUN apt-get update && apt-get install -y --no-install-recommends \ -# for MYSQL_RANDOM_ROOT_PASSWORD - pwgen \ -# for mysql_ssl_rsa_setup +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ openssl \ # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename @@ -43,9 +42,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ perl \ # install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files xz-utils \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* -RUN set -ex; \ +RUN set -eux; \ # gpg: key 3A79BD29: public key "MySQL Release Engineering " imported key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ export GNUPGHOME="$(mktemp -d)"; \ diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index 878cabc21..2077c4f75 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -33,6 +33,17 @@ RUN set -eux; \ gosu --version; \ gosu nobody true +RUN set -eux; \ + {{ dnf }} install -y \ + gzip \ + xz \ +{{ if .oracle.variant | startswith("7") then "" else ( -}} +# Oracle Linux 8+ is very slim :) + findutils \ +{{ ) end -}} + ; \ + {{ dnf }} clean all + RUN set -eux; \ # https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html # gpg: key 3A79BD29: public key "MySQL Release Engineering " imported @@ -42,11 +53,6 @@ RUN set -eux; \ gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ rm -rf "$GNUPGHOME" -{{ if .oracle.variant | startswith("7") then "" else ( -}} -# Oracle Linux 8+ is very slim :) -RUN set -eux; {{ dnf }} install -y findutils; {{ dnf }} clean all - -{{ ) end -}} ENV MYSQL_MAJOR {{ env.version }} ENV MYSQL_VERSION {{ .oracle.version }} diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index f4e6c865b..74d810080 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -245,7 +245,7 @@ docker_setup_db() { fi # Generate random root password if [ -n "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)" + MYSQL_ROOT_PASSWORD="$(openssl rand -base64 24)"; export MYSQL_ROOT_PASSWORD mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD" fi # Sets root password and creates root users for non-localhost hosts From 9e0c503080ea8ab2e55bbca26d917eee3f5f942a Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Thu, 24 Feb 2022 14:15:07 -0800 Subject: [PATCH 175/285] Update socket location for mysql clients --- 5.7/Dockerfile.oracle | 1 + 5.7/docker-entrypoint.sh | 15 +++++++++++++++ 8.0/Dockerfile.oracle | 1 + 8.0/docker-entrypoint.sh | 15 +++++++++++++++ template/Dockerfile.oracle | 1 + template/docker-entrypoint.sh | 15 +++++++++++++++ 6 files changed, 48 insertions(+) diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 0907775dc..861c2e585 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -78,6 +78,7 @@ RUN set -eux; \ grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ + { echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf; \ \ # make sure users dumping files in "/etc/mysql/conf.d" still works ! grep -F '!includedir' /etc/my.cnf; \ diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 74d810080..ba9c3ce51 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -104,6 +104,18 @@ mysql_get_config() { # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } +# Ensure that the package default socket can also be used +# since rpm packages are compiled with a different socket location +# and "mysqlsh --mysql" doesn't read the [client] config +# related to https://github.com/docker-library/mysql/issues/829 +mysql_socket_fix() { + local defaultSocket + defaultSocket="$(mysql_get_config 'socket' mysqld --no-defaults)" + if [ "$defaultSocket" != "$SOCKET" ]; then + ln -sfTv "$SOCKET" "$defaultSocket" || : + fi +} + # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { if [ "${MYSQL_MAJOR}" = '5.7' ]; then @@ -366,6 +378,7 @@ _main() { docker_temp_server_start "$@" mysql_note "Temporary server started." + mysql_socket_fix docker_setup_db docker_process_init_files /docker-entrypoint-initdb.d/* @@ -378,6 +391,8 @@ _main() { echo mysql_note "MySQL init process done. Ready for start up." echo + else + mysql_socket_fix fi fi exec "$@" diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 36be9f734..7f2458089 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -80,6 +80,7 @@ RUN set -eux; \ grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ + { echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf; \ \ # make sure users dumping files in "/etc/mysql/conf.d" still works ! grep -F '!includedir' /etc/my.cnf; \ diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 74d810080..ba9c3ce51 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -104,6 +104,18 @@ mysql_get_config() { # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } +# Ensure that the package default socket can also be used +# since rpm packages are compiled with a different socket location +# and "mysqlsh --mysql" doesn't read the [client] config +# related to https://github.com/docker-library/mysql/issues/829 +mysql_socket_fix() { + local defaultSocket + defaultSocket="$(mysql_get_config 'socket' mysqld --no-defaults)" + if [ "$defaultSocket" != "$SOCKET" ]; then + ln -sfTv "$SOCKET" "$defaultSocket" || : + fi +} + # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { if [ "${MYSQL_MAJOR}" = '5.7' ]; then @@ -366,6 +378,7 @@ _main() { docker_temp_server_start "$@" mysql_note "Temporary server started." + mysql_socket_fix docker_setup_db docker_process_init_files /docker-entrypoint-initdb.d/* @@ -378,6 +391,8 @@ _main() { echo mysql_note "MySQL init process done. Ready for start up." echo + else + mysql_socket_fix fi fi exec "$@" diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index 2077c4f75..d38873935 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -77,6 +77,7 @@ RUN set -eux; \ grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ + { echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf; \ \ # make sure users dumping files in "/etc/mysql/conf.d" still works ! grep -F '!includedir' /etc/my.cnf; \ diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index 74d810080..ba9c3ce51 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -104,6 +104,18 @@ mysql_get_config() { # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" } +# Ensure that the package default socket can also be used +# since rpm packages are compiled with a different socket location +# and "mysqlsh --mysql" doesn't read the [client] config +# related to https://github.com/docker-library/mysql/issues/829 +mysql_socket_fix() { + local defaultSocket + defaultSocket="$(mysql_get_config 'socket' mysqld --no-defaults)" + if [ "$defaultSocket" != "$SOCKET" ]; then + ln -sfTv "$SOCKET" "$defaultSocket" || : + fi +} + # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { if [ "${MYSQL_MAJOR}" = '5.7' ]; then @@ -366,6 +378,7 @@ _main() { docker_temp_server_start "$@" mysql_note "Temporary server started." + mysql_socket_fix docker_setup_db docker_process_init_files /docker-entrypoint-initdb.d/* @@ -378,6 +391,8 @@ _main() { echo mysql_note "MySQL init process done. Ready for start up." echo + else + mysql_socket_fix fi fi exec "$@" From ac8e5fb6d47dc1bd02e916443297ee27f5e5da55 Mon Sep 17 00:00:00 2001 From: Petri Pyy Date: Fri, 25 Feb 2022 17:05:16 +0200 Subject: [PATCH 176/285] add missing openssl dependency --- 5.7/Dockerfile.oracle | 1 + 8.0/Dockerfile.oracle | 1 + template/Dockerfile.oracle | 1 + 3 files changed, 3 insertions(+) diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 0907775dc..81ea45afa 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -41,6 +41,7 @@ RUN set -eux; \ RUN set -eux; \ yum install -y \ gzip \ + openssl \ xz \ ; \ yum clean all diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 36be9f734..828f2c105 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -41,6 +41,7 @@ RUN set -eux; \ RUN set -eux; \ microdnf install -y \ gzip \ + openssl \ xz \ # Oracle Linux 8+ is very slim :) findutils \ diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index 2077c4f75..064d3a4d3 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -36,6 +36,7 @@ RUN set -eux; \ RUN set -eux; \ {{ dnf }} install -y \ gzip \ + openssl \ xz \ {{ if .oracle.variant | startswith("7") then "" else ( -}} # Oracle Linux 8+ is very slim :) From 546838ab256ad36a9f6571e900deb7c4040cd383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Molinero=20Fern=C3=A1ndez?= Date: Thu, 20 May 2021 22:16:23 +0200 Subject: [PATCH 177/285] Add .sql.zst support to docker-entrypoint-initdb.d --- 5.7/Dockerfile.debian | 2 +- 5.7/Dockerfile.oracle | 1 + 5.7/docker-entrypoint.sh | 9 +++++---- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 1 + 8.0/docker-entrypoint.sh | 9 +++++---- template/Dockerfile.debian | 2 +- template/Dockerfile.oracle | 1 + template/docker-entrypoint.sh | 9 +++++---- 9 files changed, 21 insertions(+), 15 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 7da445782..24baf6425 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -46,8 +46,8 @@ RUN set -eux; \ # Sys::Hostname # Data::Dumper perl \ -# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files xz-utils \ + zstd \ ; \ rm -rf /var/lib/apt/lists/* diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index ea4d58744..c8c07fab3 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -43,6 +43,7 @@ RUN set -eux; \ gzip \ openssl \ xz \ + zstd \ ; \ yum clean all diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index ba9c3ce51..adbbf06ee 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -72,10 +72,11 @@ docker_process_init_files() { . "$f" fi ;; - *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; - *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; - *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; - *) mysql_warn "$0: ignoring $f" ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; + *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; + *) mysql_warn "$0: ignoring $f" ;; esac echo done diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 6c308f283..9eb30998f 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -46,8 +46,8 @@ RUN set -eux; \ # Sys::Hostname # Data::Dumper perl \ -# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files xz-utils \ + zstd \ ; \ rm -rf /var/lib/apt/lists/* diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 9b517fc38..556bb5ffa 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -43,6 +43,7 @@ RUN set -eux; \ gzip \ openssl \ xz \ + zstd \ # Oracle Linux 8+ is very slim :) findutils \ ; \ diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index ba9c3ce51..adbbf06ee 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -72,10 +72,11 @@ docker_process_init_files() { . "$f" fi ;; - *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; - *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; - *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; - *) mysql_warn "$0: ignoring $f" ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; + *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; + *) mysql_warn "$0: ignoring $f" ;; esac echo done diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index cb4cad805..7fc0a3dc4 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -40,8 +40,8 @@ RUN set -eux; \ # Sys::Hostname # Data::Dumper perl \ -# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files xz-utils \ + zstd \ ; \ rm -rf /var/lib/apt/lists/* diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index 93d660a0d..a58e5c1f3 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -38,6 +38,7 @@ RUN set -eux; \ gzip \ openssl \ xz \ + zstd \ {{ if .oracle.variant | startswith("7") then "" else ( -}} # Oracle Linux 8+ is very slim :) findutils \ diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index ba9c3ce51..adbbf06ee 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -72,10 +72,11 @@ docker_process_init_files() { . "$f" fi ;; - *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; - *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; - *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; - *) mysql_warn "$0: ignoring $f" ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; + *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; + *) mysql_warn "$0: ignoring $f" ;; esac echo done From e4b225b3eed5c774fa11799f04832e0ad351da62 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 25 Mar 2022 14:50:37 -0700 Subject: [PATCH 178/285] Fix Dockerfile linguist Git attributes --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index f5f31a4d1..dfa02cc85 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,3 @@ /*.*/**/Dockerfile* linguist-generated /*.*/**/docker-entrypoint.sh linguist-generated -/template/Dockerfile* linguist-language=Dockerfile +Dockerfile* linguist-language=Dockerfile From 68bc91b85ffde4ec9c0ca084b092acfb28463bfa Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 26 Apr 2022 09:15:14 -0700 Subject: [PATCH 179/285] Update 8.0 to 8.0.29, debian 8.0.29-1debian10, mysql-shell 8.0.29-1.el8, oracle 8.0.29-1.el8 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 9eb30998f..e04e5049d 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.28-1debian10 +ENV MYSQL_VERSION 8.0.29-1debian10 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 556bb5ffa..e2405e173 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -59,7 +59,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.28-1.el8 +ENV MYSQL_VERSION 8.0.29-1.el8 RUN set -eu; \ . /etc/os-release; \ @@ -104,7 +104,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.28-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.29-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 0c9197b16..4af85ee9f 100644 --- a/versions.json +++ b/versions.json @@ -25,10 +25,10 @@ "amd64" ], "suite": "buster", - "version": "8.0.28-1debian10" + "version": "8.0.29-1debian10" }, "mysql-shell": { - "version": "8.0.28-1.el8" + "version": "8.0.29-1.el8" }, "oracle": { "architectures": [ @@ -36,8 +36,8 @@ "arm64v8" ], "variant": "8-slim", - "version": "8.0.28-1.el8" + "version": "8.0.29-1.el8" }, - "version": "8.0.28" + "version": "8.0.29" } } From 7c4eca3ee491d62d3aa5442c864c43355ab34f1b Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 27 Apr 2022 12:50:00 -0700 Subject: [PATCH 180/285] Update 5.7 to 5.7.38, debian 5.7.38-1debian10, mysql-shell 8.0.29-1.el7, oracle 5.7.38-1.el7 --- 5.7/Dockerfile.debian | 2 +- 5.7/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 24baf6425..2669b2eaa 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -62,7 +62,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.37-1debian10 +ENV MYSQL_VERSION 5.7.38-1debian10 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index c8c07fab3..996853044 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -57,7 +57,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.37-1.el7 +ENV MYSQL_VERSION 5.7.38-1.el7 RUN set -eu; \ . /etc/os-release; \ @@ -102,7 +102,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.28-1.el7 +ENV MYSQL_SHELL_VERSION 8.0.29-1.el7 RUN set -eux; \ yum install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ yum clean all; \ diff --git a/versions.json b/versions.json index 4af85ee9f..9fd10c86f 100644 --- a/versions.json +++ b/versions.json @@ -5,19 +5,19 @@ "amd64" ], "suite": "buster", - "version": "5.7.37-1debian10" + "version": "5.7.38-1debian10" }, "mysql-shell": { - "version": "8.0.28-1.el7" + "version": "8.0.29-1.el7" }, "oracle": { "architectures": [ "amd64" ], "variant": "7-slim", - "version": "5.7.37-1.el7" + "version": "5.7.38-1.el7" }, - "version": "5.7.37" + "version": "5.7.38" }, "8.0": { "debian": { From c96b0f7f58d48590d054952bc1e77d1f57d32452 Mon Sep 17 00:00:00 2001 From: Wouter Samaey Date: Wed, 18 May 2022 17:12:08 +0200 Subject: [PATCH 181/285] Add bunzip2 support --- 5.7/docker-entrypoint.sh | 1 + 8.0/docker-entrypoint.sh | 1 + template/docker-entrypoint.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index adbbf06ee..f0f95053c 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -73,6 +73,7 @@ docker_process_init_files() { fi ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.bz2) mysql_note "$0: running $f"; bunzip2 -c "$f" | docker_process_sql; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index adbbf06ee..f0f95053c 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -73,6 +73,7 @@ docker_process_init_files() { fi ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.bz2) mysql_note "$0: running $f"; bunzip2 -c "$f" | docker_process_sql; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index adbbf06ee..f0f95053c 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -73,6 +73,7 @@ docker_process_init_files() { fi ;; *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.bz2) mysql_note "$0: running $f"; bunzip2 -c "$f" | docker_process_sql; echo ;; *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; From 275e9822858884a85434448cb6777683692365e6 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 23 May 2022 09:39:01 -0700 Subject: [PATCH 182/285] Add "--no-dereference" to avoid attempts to chown a broken symlink --- 5.7/docker-entrypoint.sh | 2 +- 8.0/docker-entrypoint.sh | 2 +- template/docker-entrypoint.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index f0f95053c..c5de3cad1 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -197,7 +197,7 @@ docker_create_db_directories() { if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` - find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + find "$DATADIR" \! -user mysql -exec chown --no-dereference mysql '{}' + fi } diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index f0f95053c..c5de3cad1 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -197,7 +197,7 @@ docker_create_db_directories() { if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` - find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + find "$DATADIR" \! -user mysql -exec chown --no-dereference mysql '{}' + fi } diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index f0f95053c..c5de3cad1 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -197,7 +197,7 @@ docker_create_db_directories() { if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` - find "$DATADIR" \! -user mysql -exec chown mysql '{}' + + find "$DATADIR" \! -user mysql -exec chown --no-dereference mysql '{}' + fi } From 96900fa0e5d9edc95fe35b4f668e844d4193dafd Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 13 Jun 2022 16:22:06 -0700 Subject: [PATCH 183/285] Update 8.0-debian to bullseye --- 8.0/Dockerfile.debian | 6 +++--- versions.json | 4 ++-- versions.sh | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index e04e5049d..9c5229062 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:buster-slim +FROM debian:bullseye-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql @@ -62,9 +62,9 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.29-1debian10 +ENV MYSQL_VERSION 8.0.29-1debian11 -RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ buster mysql-8.0' > /etc/apt/sources.list.d/mysql.list +RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bullseye mysql-8.0' > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/versions.json b/versions.json index 9fd10c86f..c835e3cbe 100644 --- a/versions.json +++ b/versions.json @@ -24,8 +24,8 @@ "architectures": [ "amd64" ], - "suite": "buster", - "version": "8.0.29-1debian10" + "suite": "bullseye", + "version": "8.0.29-1debian11" }, "mysql-shell": { "version": "8.0.29-1.el8" diff --git a/versions.sh b/versions.sh index 4be42f426..3f8fa0fc6 100755 --- a/versions.sh +++ b/versions.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash set -Eeuo pipefail -defaultDebianSuite='buster' +defaultDebianSuite='bullseye' declare -A debianSuites=( - #[8.0]='stretch' + [5.7]='buster' ) defaultOracleVariant='8-slim' From 9ed73fdd2f2fd77591d0020e13c37602a0600eb8 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 13 Jun 2022 16:22:43 -0700 Subject: [PATCH 184/285] Update "oracle" variants to be the default variants The Oracle Linux-based images: - are smaller (by a pretty non-trivial amount - nearly 100MiB) - support more architectures (arm64!) - are more supported/recommended by MySQL upstream I do not believe it is common for users to install additional packages in images that are `FROM mysql`, but if it is, the Debian-based images are not going away with this change (those users will just have to adapt - either by switching their package installations to Oracle-based packages or by using the Debian-based variants explicitly). --- generate-stackbrew-library.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 773ba0fc2..cbf4cecc1 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -8,8 +8,8 @@ declare -A aliases=( defaultDefaultVariant='oracle' declare -A defaultVariants=( - [5.7]='debian' - [8.0]='debian' + #[5.7]='debian' + #[8.0]='debian' ) self="$(basename "$BASH_SOURCE")" From b22945da0ed9f152485cc68ff7565204e8d37db4 Mon Sep 17 00:00:00 2001 From: Wouter Samaey Date: Fri, 24 Jun 2022 15:40:32 +0200 Subject: [PATCH 185/285] Added "bzip2" so we can import .sql.bz2 dumps. --- 5.7/Dockerfile.debian | 1 + 5.7/Dockerfile.oracle | 1 + 8.0/Dockerfile.debian | 1 + 8.0/Dockerfile.oracle | 1 + template/Dockerfile.debian | 1 + template/Dockerfile.oracle | 1 + 6 files changed, 6 insertions(+) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 2669b2eaa..f2c435262 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -39,6 +39,7 @@ RUN mkdir /docker-entrypoint-initdb.d RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ + bzip2 \ openssl \ # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 996853044..4428e43a8 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -40,6 +40,7 @@ RUN set -eux; \ RUN set -eux; \ yum install -y \ + bzip2 \ gzip \ openssl \ xz \ diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index e04e5049d..96c604ecb 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -39,6 +39,7 @@ RUN mkdir /docker-entrypoint-initdb.d RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ + bzip2 \ openssl \ # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index e2405e173..f5a2fd65d 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -40,6 +40,7 @@ RUN set -eux; \ RUN set -eux; \ microdnf install -y \ + bzip2 \ gzip \ openssl \ xz \ diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index 7fc0a3dc4..d80cf1e0d 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -33,6 +33,7 @@ RUN mkdir /docker-entrypoint-initdb.d RUN set -eux; \ apt-get update; \ apt-get install -y --no-install-recommends \ + bzip2 \ openssl \ # FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: # File::Basename diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index a58e5c1f3..8a0cbad7a 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -35,6 +35,7 @@ RUN set -eux; \ RUN set -eux; \ {{ dnf }} install -y \ + bzip2 \ gzip \ openssl \ xz \ From 35b90084fed1f790832d58447cb7cea1251710bd Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 27 Jun 2022 14:19:44 -0700 Subject: [PATCH 186/285] Add --setopt=skip_missing_names_on_install=False to "yum install" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://unix.stackexchange.com/a/477127/153467 for details 🙈 --- 5.7/Dockerfile.oracle | 8 +++++--- template/Dockerfile.oracle | 26 ++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 4428e43a8..f1fb6ac5a 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -39,7 +39,9 @@ RUN set -eux; \ gosu nobody true RUN set -eux; \ - yum install -y \ +# https://github.com/docker-library/mysql/pull/871#issuecomment-1167954236 + yum install -y --setopt=skip_missing_names_on_install=False oracle-epel-release-el7; \ + yum install -y --setopt=skip_missing_names_on_install=False \ bzip2 \ gzip \ openssl \ @@ -74,7 +76,7 @@ RUN set -eu; \ } | tee /etc/yum.repos.d/mysql-community-minimal.repo RUN set -eux; \ - yum install -y "mysql-community-server-minimal-$MYSQL_VERSION"; \ + yum install -y --setopt=skip_missing_names_on_install=False "mysql-community-server-minimal-$MYSQL_VERSION"; \ yum clean all; \ # the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead) # https://github.com/docker-library/mysql/pull/680#issuecomment-636121520 @@ -105,7 +107,7 @@ RUN set -eu; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo ENV MYSQL_SHELL_VERSION 8.0.29-1.el7 RUN set -eux; \ - yum install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ + yum install -y --setopt=skip_missing_names_on_install=False "mysql-shell-$MYSQL_SHELL_VERSION"; \ yum clean all; \ \ mysqlsh --version diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index 8a0cbad7a..d71bf590a 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -1,4 +1,18 @@ -{{ def dnf: if .oracle.variant | startswith("7") then "yum" else "microdnf" end -}} +{{ + def dnf: + if .oracle.variant | startswith("7") then + "yum" + else + "microdnf" + end + ; + def dnf_install: + dnf + " install -y" + | if . == "yum install -y" then + # --setopt=skip_missing_names_on_install=False: https://unix.stackexchange.com/a/477127/153467 + . + " --setopt=skip_missing_names_on_install=False" + else . end +-}} FROM oraclelinux:{{ .oracle.variant }} RUN set -eux; \ @@ -34,7 +48,11 @@ RUN set -eux; \ gosu nobody true RUN set -eux; \ - {{ dnf }} install -y \ +{{ if .oracle.variant | startswith("7") then ( -}} +# https://github.com/docker-library/mysql/pull/871#issuecomment-1167954236 + {{ dnf_install }} oracle-epel-release-el7; \ +{{ ) else "" end -}} + {{ dnf_install }} \ bzip2 \ gzip \ openssl \ @@ -73,7 +91,7 @@ RUN set -eu; \ } | tee /etc/yum.repos.d/mysql-community-minimal.repo RUN set -eux; \ - {{ dnf }} install -y "mysql-community-server-minimal-$MYSQL_VERSION"; \ + {{ dnf_install }} "mysql-community-server-minimal-$MYSQL_VERSION"; \ {{ dnf }} clean all; \ # the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead) # https://github.com/docker-library/mysql/pull/680#issuecomment-636121520 @@ -104,7 +122,7 @@ RUN set -eu; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo ENV MYSQL_SHELL_VERSION {{ .["mysql-shell"].version }} RUN set -eux; \ - {{ dnf }} install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ + {{ dnf_install }} "mysql-shell-$MYSQL_SHELL_VERSION"; \ {{ dnf }} clean all; \ \ mysqlsh --version From ea98f69d0bdab12f99731ed74e584317c246f3fd Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 8 Jul 2022 10:36:23 -0700 Subject: [PATCH 187/285] Add "/entrypoint.sh" backwards-compat symlink in Oracle-based images --- 5.7/Dockerfile.oracle | 1 + 8.0/Dockerfile.oracle | 1 + template/Dockerfile.debian | 2 ++ template/Dockerfile.oracle | 3 +++ 4 files changed, 7 insertions(+) diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index f1fb6ac5a..3d2329e2b 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -115,6 +115,7 @@ RUN set -eux; \ VOLUME /var/lib/mysql COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] EXPOSE 3306 33060 diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index f5a2fd65d..4ae731bce 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -115,6 +115,7 @@ RUN set -eux; \ VOLUME /var/lib/mysql COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] EXPOSE 3306 33060 diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index d80cf1e0d..a0236bd53 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -96,7 +96,9 @@ VOLUME /var/lib/mysql COPY config/ /etc/mysql/ {{ ) else "" end -}} COPY docker-entrypoint.sh /usr/local/bin/ +{{ if [ "5.7", "8.0" ] | index(env.version) then ( -}} RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat +{{ ) else "" end -}} ENTRYPOINT ["docker-entrypoint.sh"] EXPOSE 3306 33060 diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index d71bf590a..4d9865e7e 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -130,6 +130,9 @@ RUN set -eux; \ VOLUME /var/lib/mysql COPY docker-entrypoint.sh /usr/local/bin/ +{{ if [ "5.7", "8.0" ] | index(env.version) then ( -}} +RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat +{{ ) else "" end -}} ENTRYPOINT ["docker-entrypoint.sh"] EXPOSE 3306 33060 From 19f5517b96ee5ee2aafb93dd7932a5e6bd3f0bc8 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 12 Jul 2022 09:20:00 -0700 Subject: [PATCH 188/285] Add /etc/mysql/mysql.conf.d in 5.7 Oracle-based images This brings them back to parity with Debian (although noting that the Debian-based 8.0 images have never included this, so I'm not adding it there). --- 5.7/Dockerfile.oracle | 3 +++ template/Dockerfile.oracle | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 3d2329e2b..882bdb369 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -89,6 +89,9 @@ RUN set -eux; \ ! grep -F '!includedir' /etc/my.cnf; \ { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ mkdir -p /etc/mysql/conf.d; \ +# 5.7 Debian-based images also included "/etc/mysql/mysql.conf.d" so let's include it too + { echo '!includedir /etc/mysql/mysql.conf.d/'; } >> /etc/my.cnf; \ + mkdir -p /etc/mysql/mysql.conf.d; \ \ mysqld --version; \ mysql --version diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index 4d9865e7e..2f2e0b957 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -104,6 +104,11 @@ RUN set -eux; \ ! grep -F '!includedir' /etc/my.cnf; \ { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ mkdir -p /etc/mysql/conf.d; \ +{{ if env.version == "5.7" then ( -}} +# 5.7 Debian-based images also included "/etc/mysql/mysql.conf.d" so let's include it too + { echo '!includedir /etc/mysql/mysql.conf.d/'; } >> /etc/my.cnf; \ + mkdir -p /etc/mysql/mysql.conf.d; \ +{{ ) else "" end -}} \ mysqld --version; \ mysql --version From 48f07e3da4f62de1adb876e9d657e7283ed12a0e Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Tue, 12 Jul 2022 14:50:08 -0700 Subject: [PATCH 189/285] Fix arbitrary user support on oracle-linux based images --- 5.7/Dockerfile.oracle | 23 +++++++++++++++-------- 8.0/Dockerfile.oracle | 17 +++++++++-------- template/Dockerfile.oracle | 23 +++++++++++++++-------- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 882bdb369..d173e0ff6 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -8,14 +8,7 @@ FROM oraclelinux:7-slim RUN set -eux; \ groupadd --system --gid 999 mysql; \ - useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql; \ - \ - mkdir /var/lib/mysql /var/run/mysqld; \ - chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - chmod 1777 /var/lib/mysql /var/run/mysqld; \ - \ - mkdir /docker-entrypoint-initdb.d + useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases @@ -93,6 +86,20 @@ RUN set -eux; \ { echo '!includedir /etc/mysql/mysql.conf.d/'; } >> /etc/my.cnf; \ mkdir -p /etc/mysql/mysql.conf.d; \ \ +# comment out a few problematic configuration values + find /etc/my.cnf /etc/mysql/ -name '*.cnf' -print0 \ + | xargs -0 grep -lZE '^(bind-address|log)' \ + | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; \ + \ +# ensure these directories exist and have useful permissions +# the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install + mkdir -p /var/lib/mysql /var/run/mysqld; \ + chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + chmod 1777 /var/lib/mysql /var/run/mysqld; \ + \ + mkdir /docker-entrypoint-initdb.d; \ + \ mysqld --version; \ mysql --version diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 4ae731bce..53edac964 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -8,14 +8,7 @@ FROM oraclelinux:8-slim RUN set -eux; \ groupadd --system --gid 999 mysql; \ - useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql; \ - \ - mkdir /var/lib/mysql /var/run/mysqld; \ - chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - chmod 1777 /var/lib/mysql /var/run/mysqld; \ - \ - mkdir /docker-entrypoint-initdb.d + useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases @@ -89,6 +82,14 @@ RUN set -eux; \ ! grep -F '!includedir' /etc/my.cnf; \ { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ mkdir -p /etc/mysql/conf.d; \ +# ensure these directories exist and have useful permissions +# the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install + mkdir -p /var/lib/mysql /var/run/mysqld; \ + chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + chmod 1777 /var/lib/mysql /var/run/mysqld; \ + \ + mkdir /docker-entrypoint-initdb.d; \ \ mysqld --version; \ mysql --version diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index 2f2e0b957..e050b5722 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -17,14 +17,7 @@ FROM oraclelinux:{{ .oracle.variant }} RUN set -eux; \ groupadd --system --gid 999 mysql; \ - useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql; \ - \ - mkdir /var/lib/mysql /var/run/mysqld; \ - chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - chmod 1777 /var/lib/mysql /var/run/mysqld; \ - \ - mkdir /docker-entrypoint-initdb.d + useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases @@ -108,7 +101,21 @@ RUN set -eux; \ # 5.7 Debian-based images also included "/etc/mysql/mysql.conf.d" so let's include it too { echo '!includedir /etc/mysql/mysql.conf.d/'; } >> /etc/my.cnf; \ mkdir -p /etc/mysql/mysql.conf.d; \ + \ +# comment out a few problematic configuration values + find /etc/my.cnf /etc/mysql/ -name '*.cnf' -print0 \ + | xargs -0 grep -lZE '^(bind-address|log)' \ + | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; \ + \ {{ ) else "" end -}} +# ensure these directories exist and have useful permissions +# the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install + mkdir -p /var/lib/mysql /var/run/mysqld; \ + chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + chmod 1777 /var/lib/mysql /var/run/mysqld; \ + \ + mkdir /docker-entrypoint-initdb.d; \ \ mysqld --version; \ mysql --version From 653507234ff9d3d1c0bef2f6093fbae30a7a021d Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 13 Jul 2022 17:13:58 -0700 Subject: [PATCH 190/285] Update jq-template for speed improvements --- apply-templates.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apply-templates.sh b/apply-templates.sh index 59053f54f..05db7e521 100755 --- a/apply-templates.sh +++ b/apply-templates.sh @@ -9,7 +9,8 @@ jqt='.jq-template.awk' if [ -n "${BASHBREW_SCRIPTS:-}" ]; then jqt="$BASHBREW_SCRIPTS/jq-template.awk" elif [ "$BASH_SOURCE" -nt "$jqt" ]; then - wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/5f0c26381fb7cc78b2d217d58007800bdcfbcfa1/scripts/jq-template.awk' + # https://github.com/docker-library/bashbrew/blob/master/scripts/jq-template.awk + wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/9f6a35772ac863a0241f147c820354e4008edf38/scripts/jq-template.awk' fi if [ "$#" -eq 0 ]; then From eb9697a801186d440355c55e81512e0441a5a854 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 26 Jul 2022 09:15:13 -0700 Subject: [PATCH 191/285] Update 5.7 to 5.7.39, debian 5.7.39-1debian10, mysql-shell 8.0.30-1.el7, oracle 5.7.39-1.el7 --- 5.7/Dockerfile.debian | 2 +- 5.7/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index f2c435262..9511838fb 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -63,7 +63,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.38-1debian10 +ENV MYSQL_VERSION 5.7.39-1debian10 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index d173e0ff6..1e051bf11 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.38-1.el7 +ENV MYSQL_VERSION 5.7.39-1.el7 RUN set -eu; \ . /etc/os-release; \ @@ -115,7 +115,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.29-1.el7 +ENV MYSQL_SHELL_VERSION 8.0.30-1.el7 RUN set -eux; \ yum install -y --setopt=skip_missing_names_on_install=False "mysql-shell-$MYSQL_SHELL_VERSION"; \ yum clean all; \ diff --git a/versions.json b/versions.json index c835e3cbe..a5f43eff1 100644 --- a/versions.json +++ b/versions.json @@ -5,19 +5,19 @@ "amd64" ], "suite": "buster", - "version": "5.7.38-1debian10" + "version": "5.7.39-1debian10" }, "mysql-shell": { - "version": "8.0.29-1.el7" + "version": "8.0.30-1.el7" }, "oracle": { "architectures": [ "amd64" ], "variant": "7-slim", - "version": "5.7.38-1.el7" + "version": "5.7.39-1.el7" }, - "version": "5.7.38" + "version": "5.7.39" }, "8.0": { "debian": { From 8a1c1d3c30e71c8efef064e26064a195737e7e1d Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 26 Jul 2022 12:49:33 -0700 Subject: [PATCH 192/285] Update 8.0 to 8.0.30, debian 8.0.30-1debian11, mysql-shell 8.0.30-1.el8, oracle 8.0.30-1.el8 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 5e6d5f7ea..8148c87e9 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -63,7 +63,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.29-1debian11 +ENV MYSQL_VERSION 8.0.30-1debian11 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bullseye mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 53edac964..a111ba91e 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.29-1.el8 +ENV MYSQL_VERSION 8.0.30-1.el8 RUN set -eu; \ . /etc/os-release; \ @@ -106,7 +106,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.29-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.30-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index a5f43eff1..c61b2b719 100644 --- a/versions.json +++ b/versions.json @@ -25,10 +25,10 @@ "amd64" ], "suite": "bullseye", - "version": "8.0.29-1debian11" + "version": "8.0.30-1debian11" }, "mysql-shell": { - "version": "8.0.29-1.el8" + "version": "8.0.30-1.el8" }, "oracle": { "architectures": [ @@ -36,8 +36,8 @@ "arm64v8" ], "variant": "8-slim", - "version": "8.0.29-1.el8" + "version": "8.0.30-1.el8" }, - "version": "8.0.29" + "version": "8.0.30" } } From 3ec244b5f50dae961690825b8a046fc722efda49 Mon Sep 17 00:00:00 2001 From: Petr Fedchenkov Date: Sat, 13 Nov 2021 15:28:41 +0300 Subject: [PATCH 193/285] Ensure that directories for pid and socket exists We create directory in /var/run during image creation, but for example containerd mount tmpfs on /run directory. We can lose content of directory in this case, so we must ensure that it exists Signed-off-by: Petr Fedchenkov --- 5.7/docker-entrypoint.sh | 41 ++++++++++++++++++++++++++++++----- 8.0/docker-entrypoint.sh | 41 ++++++++++++++++++++++++++++++----- template/docker-entrypoint.sh | 41 ++++++++++++++++++++++++++++++----- 3 files changed, 108 insertions(+), 15 deletions(-) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index c5de3cad1..0a068c58d 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -191,13 +191,44 @@ docker_verify_minimum_env() { docker_create_db_directories() { local user; user="$(id -u)" - # TODO other directories that are used by default? like /var/lib/mysql-files - # see https://github.com/docker-library/mysql/issues/562 - mkdir -p "$DATADIR" + local -A dirs=( ["$DATADIR"]=1 ) + local dir + dir="$(dirname "$SOCKET")" + dirs["$dir"]=1 + + # "datadir" and "socket" are already handled above (since they were already queried previously) + local conf + for conf in \ + general-log-file \ + keyring_file_data \ + pid-file \ + secure-file-priv \ + slow-query-log-file \ + ; do + dir="$(mysql_get_config "$conf" "$@")" + + # skip empty values + if [ -z "$dir" ]; then + continue + fi + case "$conf" in + secure-file-priv) + # already points at a directory + ;; + *) + # other config options point at a file, but we need the directory + dir="$(dirname "$dir")" + ;; + esac + + dirs["$dir"]=1 + done + + mkdir -p "${!dirs[@]}" if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` - find "$DATADIR" \! -user mysql -exec chown --no-dereference mysql '{}' + + find "${!dirs[@]}" \! -user mysql -exec chown --no-dereference mysql '{}' + fi } @@ -359,7 +390,7 @@ _main() { mysql_check_config "$@" # Load various environment variables docker_setup_env "$@" - docker_create_db_directories + docker_create_db_directories "$@" # If container is started as root user, restart as dedicated mysql user if [ "$(id -u)" = "0" ]; then diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index c5de3cad1..0a068c58d 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -191,13 +191,44 @@ docker_verify_minimum_env() { docker_create_db_directories() { local user; user="$(id -u)" - # TODO other directories that are used by default? like /var/lib/mysql-files - # see https://github.com/docker-library/mysql/issues/562 - mkdir -p "$DATADIR" + local -A dirs=( ["$DATADIR"]=1 ) + local dir + dir="$(dirname "$SOCKET")" + dirs["$dir"]=1 + + # "datadir" and "socket" are already handled above (since they were already queried previously) + local conf + for conf in \ + general-log-file \ + keyring_file_data \ + pid-file \ + secure-file-priv \ + slow-query-log-file \ + ; do + dir="$(mysql_get_config "$conf" "$@")" + + # skip empty values + if [ -z "$dir" ]; then + continue + fi + case "$conf" in + secure-file-priv) + # already points at a directory + ;; + *) + # other config options point at a file, but we need the directory + dir="$(dirname "$dir")" + ;; + esac + + dirs["$dir"]=1 + done + + mkdir -p "${!dirs[@]}" if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` - find "$DATADIR" \! -user mysql -exec chown --no-dereference mysql '{}' + + find "${!dirs[@]}" \! -user mysql -exec chown --no-dereference mysql '{}' + fi } @@ -359,7 +390,7 @@ _main() { mysql_check_config "$@" # Load various environment variables docker_setup_env "$@" - docker_create_db_directories + docker_create_db_directories "$@" # If container is started as root user, restart as dedicated mysql user if [ "$(id -u)" = "0" ]; then diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index c5de3cad1..0a068c58d 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -191,13 +191,44 @@ docker_verify_minimum_env() { docker_create_db_directories() { local user; user="$(id -u)" - # TODO other directories that are used by default? like /var/lib/mysql-files - # see https://github.com/docker-library/mysql/issues/562 - mkdir -p "$DATADIR" + local -A dirs=( ["$DATADIR"]=1 ) + local dir + dir="$(dirname "$SOCKET")" + dirs["$dir"]=1 + + # "datadir" and "socket" are already handled above (since they were already queried previously) + local conf + for conf in \ + general-log-file \ + keyring_file_data \ + pid-file \ + secure-file-priv \ + slow-query-log-file \ + ; do + dir="$(mysql_get_config "$conf" "$@")" + + # skip empty values + if [ -z "$dir" ]; then + continue + fi + case "$conf" in + secure-file-priv) + # already points at a directory + ;; + *) + # other config options point at a file, but we need the directory + dir="$(dirname "$dir")" + ;; + esac + + dirs["$dir"]=1 + done + + mkdir -p "${!dirs[@]}" if [ "$user" = "0" ]; then # this will cause less disk access than `chown -R` - find "$DATADIR" \! -user mysql -exec chown --no-dereference mysql '{}' + + find "${!dirs[@]}" \! -user mysql -exec chown --no-dereference mysql '{}' + fi } @@ -359,7 +390,7 @@ _main() { mysql_check_config "$@" # Load various environment variables docker_setup_env "$@" - docker_create_db_directories + docker_create_db_directories "$@" # If container is started as root user, restart as dedicated mysql user if [ "$(id -u)" = "0" ]; then From e03765d83c1fddcfb48fa47dda6171c50b563382 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 24 Aug 2022 13:39:35 -0700 Subject: [PATCH 194/285] Ignore "NULL" values in mkdir loop --- 5.7/docker-entrypoint.sh | 2 +- 8.0/docker-entrypoint.sh | 2 +- template/docker-entrypoint.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 0a068c58d..5819a38e9 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -208,7 +208,7 @@ docker_create_db_directories() { dir="$(mysql_get_config "$conf" "$@")" # skip empty values - if [ -z "$dir" ]; then + if [ -z "$dir" ] || [ "$dir" = 'NULL' ]; then continue fi case "$conf" in diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 0a068c58d..5819a38e9 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -208,7 +208,7 @@ docker_create_db_directories() { dir="$(mysql_get_config "$conf" "$@")" # skip empty values - if [ -z "$dir" ]; then + if [ -z "$dir" ] || [ "$dir" = 'NULL' ]; then continue fi case "$conf" in diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index 0a068c58d..5819a38e9 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -208,7 +208,7 @@ docker_create_db_directories() { dir="$(mysql_get_config "$conf" "$@")" # skip empty values - if [ -z "$dir" ]; then + if [ -z "$dir" ] || [ "$dir" = 'NULL' ]; then continue fi case "$conf" in From 167bab0210fbe9bb83bb7bc1b5553dc85146b089 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 10 Oct 2022 21:15:13 -0700 Subject: [PATCH 195/285] Update 5.7 to 5.7.40, debian 5.7.40-1debian10, mysql-shell 8.0.31-1.el7, oracle 5.7.40-1.el7 --- 5.7/Dockerfile.debian | 2 +- 5.7/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 9511838fb..cbefcbcaa 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -63,7 +63,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.39-1debian10 +ENV MYSQL_VERSION 5.7.40-1debian10 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 1e051bf11..a6ea80462 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.39-1.el7 +ENV MYSQL_VERSION 5.7.40-1.el7 RUN set -eu; \ . /etc/os-release; \ @@ -115,7 +115,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.30-1.el7 +ENV MYSQL_SHELL_VERSION 8.0.31-1.el7 RUN set -eux; \ yum install -y --setopt=skip_missing_names_on_install=False "mysql-shell-$MYSQL_SHELL_VERSION"; \ yum clean all; \ diff --git a/versions.json b/versions.json index c61b2b719..681f5e606 100644 --- a/versions.json +++ b/versions.json @@ -5,19 +5,19 @@ "amd64" ], "suite": "buster", - "version": "5.7.39-1debian10" + "version": "5.7.40-1debian10" }, "mysql-shell": { - "version": "8.0.30-1.el7" + "version": "8.0.31-1.el7" }, "oracle": { "architectures": [ "amd64" ], "variant": "7-slim", - "version": "5.7.39-1.el7" + "version": "5.7.40-1.el7" }, - "version": "5.7.39" + "version": "5.7.40" }, "8.0": { "debian": { From 80c475648969a83e52802e8eb2ad90519f882421 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 10 Oct 2022 21:19:25 -0700 Subject: [PATCH 196/285] Update 8.0 to 8.0.31, debian 8.0.31-1debian11, mysql-shell 8.0.31-1.el8, oracle 8.0.31-1.el8 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 8148c87e9..95b053f2f 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -63,7 +63,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.30-1debian11 +ENV MYSQL_VERSION 8.0.31-1debian11 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bullseye mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index a111ba91e..23a42e6cf 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.30-1.el8 +ENV MYSQL_VERSION 8.0.31-1.el8 RUN set -eu; \ . /etc/os-release; \ @@ -106,7 +106,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.30-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.31-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 681f5e606..80ae55f9c 100644 --- a/versions.json +++ b/versions.json @@ -25,10 +25,10 @@ "amd64" ], "suite": "bullseye", - "version": "8.0.30-1debian11" + "version": "8.0.31-1debian11" }, "mysql-shell": { - "version": "8.0.30-1.el8" + "version": "8.0.31-1.el8" }, "oracle": { "architectures": [ @@ -36,8 +36,8 @@ "arm64v8" ], "variant": "8-slim", - "version": "8.0.30-1.el8" + "version": "8.0.31-1.el8" }, - "version": "8.0.30" + "version": "8.0.31" } } From 858a4479813a8749000c477a6bf6a3b913cb9096 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Fri, 14 Oct 2022 17:24:33 -0700 Subject: [PATCH 197/285] Switch to "$GITHUB_OUTPUT"; update actions/checkout to v3 - https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands - https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter --- .github/workflows/ci.yml | 6 +++--- .github/workflows/verify-templating.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 155ef3165..e105455ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,14 +18,14 @@ jobs: outputs: strategy: ${{ steps.generate-jobs.outputs.strategy }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - id: generate-jobs name: Generate Jobs run: | git clone --depth 1 https://github.com/docker-library/bashbrew.git -b master ~/bashbrew strategy="$(~/bashbrew/scripts/github-actions/generate.sh)" + echo "strategy=$strategy" >> "$GITHUB_OUTPUT" jq . <<<"$strategy" # sanity check / debugging aid - echo "::set-output name=strategy::$strategy" test: needs: generate-jobs @@ -33,7 +33,7 @@ jobs: name: ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Prepare Environment run: ${{ matrix.runs.prepare }} - name: Pull Dependencies diff --git a/.github/workflows/verify-templating.yml b/.github/workflows/verify-templating.yml index 7e833f1c7..14497bec6 100644 --- a/.github/workflows/verify-templating.yml +++ b/.github/workflows/verify-templating.yml @@ -13,7 +13,7 @@ jobs: name: Check For Uncomitted Changes runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Apply Templates run: ./apply-templates.sh - name: Check Git Status From e0d43b2a29867c5b7d5c01a8fea30a086861df2b Mon Sep 17 00:00:00 2001 From: Chilin-Macbook Date: Sat, 27 Aug 2022 17:23:19 +0800 Subject: [PATCH 198/285] Add more clear description when password option not specified --- 5.7/docker-entrypoint.sh | 2 +- 8.0/docker-entrypoint.sh | 2 +- template/docker-entrypoint.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh index 5819a38e9..6ce3baea8 100755 --- a/5.7/docker-entrypoint.sh +++ b/5.7/docker-entrypoint.sh @@ -160,7 +160,7 @@ docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then mysql_error <<-'EOF' Database is uninitialized and password option is not specified - You need to specify one of the following: + You need to specify one of the following as an environment variable: - MYSQL_ROOT_PASSWORD - MYSQL_ALLOW_EMPTY_PASSWORD - MYSQL_RANDOM_ROOT_PASSWORD diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 5819a38e9..6ce3baea8 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -160,7 +160,7 @@ docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then mysql_error <<-'EOF' Database is uninitialized and password option is not specified - You need to specify one of the following: + You need to specify one of the following as an environment variable: - MYSQL_ROOT_PASSWORD - MYSQL_ALLOW_EMPTY_PASSWORD - MYSQL_RANDOM_ROOT_PASSWORD diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index 5819a38e9..6ce3baea8 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -160,7 +160,7 @@ docker_verify_minimum_env() { if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then mysql_error <<-'EOF' Database is uninitialized and password option is not specified - You need to specify one of the following: + You need to specify one of the following as an environment variable: - MYSQL_ROOT_PASSWORD - MYSQL_ALLOW_EMPTY_PASSWORD - MYSQL_RANDOM_ROOT_PASSWORD From 43450e73ddb98a9332c5ff2821d189928047ebb6 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 16 Nov 2022 14:06:12 -0800 Subject: [PATCH 199/285] Use new "bashbrew" composite action --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e105455ad..3860c115c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,11 +19,11 @@ jobs: strategy: ${{ steps.generate-jobs.outputs.strategy }} steps: - uses: actions/checkout@v3 + - uses: docker-library/bashbrew@HEAD - id: generate-jobs name: Generate Jobs run: | - git clone --depth 1 https://github.com/docker-library/bashbrew.git -b master ~/bashbrew - strategy="$(~/bashbrew/scripts/github-actions/generate.sh)" + strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")" echo "strategy=$strategy" >> "$GITHUB_OUTPUT" jq . <<<"$strategy" # sanity check / debugging aid From 1930ff79b1624fe6f8bdd9b3acc3c336d3c1ff3d Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 20 Dec 2022 14:22:45 -0800 Subject: [PATCH 200/285] Update generated README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4513e4ab7..a71f5b5ee 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,11 @@ For outstanding `mysql` image PRs, check [PRs with the "library/mysql" label on --- -- [![build status badge](https://img.shields.io/github/workflow/status/docker-library/mysql/GitHub%20CI/master?label=GitHub%20CI)](https://github.com/docker-library/mysql/actions?query=workflow%3A%22GitHub+CI%22+branch%3Amaster) +- [![build status badge](https://img.shields.io/github/actions/workflow/status/docker-library/mysql/ci.yml?branch=master&label=GitHub%20CI)](https://github.com/docker-library/mysql/actions?query=workflow%3A%22GitHub+CI%22+branch%3Amaster) - [![build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/mysql.svg?label=Automated%20update.sh)](https://doi-janky.infosiftr.net/job/update.sh/job/mysql/) | Build | Status | Badges | (per-arch) | |:-:|:-:|:-:|:-:| -| [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql/) | [![put-shared build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql.svg?label=put-shared)](https://doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql/) | +| [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql/) | [![arm64v8 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/mysql.svg?label=arm64v8)](https://doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/mysql/) | [![put-shared build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql.svg?label=put-shared)](https://doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql/) | From 77d590d7d141caa3280ff2d838f70c6581a9d704 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 17 Jan 2023 09:15:11 -0800 Subject: [PATCH 201/285] Update 5.7 to 5.7.41, debian 5.7.41-1debian10, mysql-shell 8.0.32-1.el7, oracle 5.7.41-1.el7 --- 5.7/Dockerfile.debian | 2 +- 5.7/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index cbefcbcaa..3926e7944 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -63,7 +63,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.40-1debian10 +ENV MYSQL_VERSION 5.7.41-1debian10 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index a6ea80462..a3cd812c1 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.40-1.el7 +ENV MYSQL_VERSION 5.7.41-1.el7 RUN set -eu; \ . /etc/os-release; \ @@ -115,7 +115,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.31-1.el7 +ENV MYSQL_SHELL_VERSION 8.0.32-1.el7 RUN set -eux; \ yum install -y --setopt=skip_missing_names_on_install=False "mysql-shell-$MYSQL_SHELL_VERSION"; \ yum clean all; \ diff --git a/versions.json b/versions.json index 80ae55f9c..2cff593ef 100644 --- a/versions.json +++ b/versions.json @@ -5,19 +5,19 @@ "amd64" ], "suite": "buster", - "version": "5.7.40-1debian10" + "version": "5.7.41-1debian10" }, "mysql-shell": { - "version": "8.0.31-1.el7" + "version": "8.0.32-1.el7" }, "oracle": { "architectures": [ "amd64" ], "variant": "7-slim", - "version": "5.7.40-1.el7" + "version": "5.7.41-1.el7" }, - "version": "5.7.40" + "version": "5.7.41" }, "8.0": { "debian": { From b3dc453ce1a149ad698e29715d818cf042605163 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 17 Jan 2023 09:19:33 -0800 Subject: [PATCH 202/285] Update 8.0 to 8.0.32, debian 8.0.32-1debian11, mysql-shell 8.0.32-1.el8, oracle 8.0.32-1.el8 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 95b053f2f..33b9e1bb0 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -63,7 +63,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.31-1debian11 +ENV MYSQL_VERSION 8.0.32-1debian11 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bullseye mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 23a42e6cf..faa4ae45e 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.31-1.el8 +ENV MYSQL_VERSION 8.0.32-1.el8 RUN set -eu; \ . /etc/os-release; \ @@ -106,7 +106,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.31-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.32-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 2cff593ef..14aa6b13f 100644 --- a/versions.json +++ b/versions.json @@ -25,10 +25,10 @@ "amd64" ], "suite": "bullseye", - "version": "8.0.31-1debian11" + "version": "8.0.32-1debian11" }, "mysql-shell": { - "version": "8.0.31-1.el8" + "version": "8.0.32-1.el8" }, "oracle": { "architectures": [ @@ -36,8 +36,8 @@ "arm64v8" ], "variant": "8-slim", - "version": "8.0.31-1.el8" + "version": "8.0.32-1.el8" }, - "version": "8.0.31" + "version": "8.0.32" } } From 358c2e5ab6cd24b86a20a871820ecbc67a244368 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 30 Jan 2023 10:40:15 -0800 Subject: [PATCH 203/285] Update to gosu 1.16 See https://github.com/tianon/gosu/releases/tag/1.16 (especially https://github.com/tianon/gosu/blob/master/SECURITY.md) --- 5.7/Dockerfile.debian | 2 +- 5.7/Dockerfile.oracle | 2 +- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 2 +- template/Dockerfile.debian | 2 +- template/Dockerfile.oracle | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 3926e7944..8b4180e4b 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr & # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.14 +ENV GOSU_VERSION 1.16 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index a3cd812c1..9f14e7027 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -12,7 +12,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.14 +ENV GOSU_VERSION 1.16 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 33b9e1bb0..ce5c15e9c 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr & # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.14 +ENV GOSU_VERSION 1.16 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index faa4ae45e..9a1efa273 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -12,7 +12,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.14 +ENV GOSU_VERSION 1.16 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index a0236bd53..14d00278f 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr & # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.14 +ENV GOSU_VERSION 1.16 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index e050b5722..1027d4466 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -21,7 +21,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.14 +ENV GOSU_VERSION 1.16 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ From e4bdff20153e6a05364a8fe80356dcfd502445bd Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 17 Apr 2023 09:15:13 -0700 Subject: [PATCH 204/285] Update 5.7 to 5.7.42, debian 5.7.42-1debian10, mysql-shell 8.0.33-1.el7, oracle 5.7.42-1.el7 --- 5.7/Dockerfile.debian | 2 +- 5.7/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 8b4180e4b..3aa33e91d 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -63,7 +63,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.41-1debian10 +ENV MYSQL_VERSION 5.7.42-1debian10 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 9f14e7027..8cf9189ba 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.41-1.el7 +ENV MYSQL_VERSION 5.7.42-1.el7 RUN set -eu; \ . /etc/os-release; \ @@ -115,7 +115,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.32-1.el7 +ENV MYSQL_SHELL_VERSION 8.0.33-1.el7 RUN set -eux; \ yum install -y --setopt=skip_missing_names_on_install=False "mysql-shell-$MYSQL_SHELL_VERSION"; \ yum clean all; \ diff --git a/versions.json b/versions.json index 14aa6b13f..e4eed13d6 100644 --- a/versions.json +++ b/versions.json @@ -5,19 +5,19 @@ "amd64" ], "suite": "buster", - "version": "5.7.41-1debian10" + "version": "5.7.42-1debian10" }, "mysql-shell": { - "version": "8.0.32-1.el7" + "version": "8.0.33-1.el7" }, "oracle": { "architectures": [ "amd64" ], "variant": "7-slim", - "version": "5.7.41-1.el7" + "version": "5.7.42-1.el7" }, - "version": "5.7.41" + "version": "5.7.42" }, "8.0": { "debian": { From 1bfa4724fe112b4246672ed2b3c42142f17d5636 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 17 Apr 2023 09:19:55 -0700 Subject: [PATCH 205/285] Update 8.0 to 8.0.33, debian 8.0.33-1debian11, mysql-shell 8.0.33-1.el8, oracle 8.0.33-1.el8 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index ce5c15e9c..3408336e4 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -63,7 +63,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.32-1debian11 +ENV MYSQL_VERSION 8.0.33-1debian11 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bullseye mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 9a1efa273..b71470d5b 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.32-1.el8 +ENV MYSQL_VERSION 8.0.33-1.el8 RUN set -eu; \ . /etc/os-release; \ @@ -106,7 +106,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.32-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.33-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index e4eed13d6..2bb764602 100644 --- a/versions.json +++ b/versions.json @@ -25,10 +25,10 @@ "amd64" ], "suite": "bullseye", - "version": "8.0.32-1debian11" + "version": "8.0.33-1debian11" }, "mysql-shell": { - "version": "8.0.32-1.el8" + "version": "8.0.33-1.el8" }, "oracle": { "architectures": [ @@ -36,8 +36,8 @@ "arm64v8" ], "variant": "8-slim", - "version": "8.0.32-1.el8" + "version": "8.0.33-1.el8" }, - "version": "8.0.32" + "version": "8.0.33" } } From 611aa464a96f69e5d4d4172b14ca829ded162b42 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 28 Apr 2023 15:25:55 -0700 Subject: [PATCH 206/285] Remove explicit `dirmngr` reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is pulled in automatically via `gnupg`, and moved from `Recommends` to `Depends` in https://salsa.debian.org/debian/gnupg2/-/commit/99474ad900a8bcdd0e7b68f986fec0013fc01470, which has been part of `src:gnupg2` since 2.1.21-4 (and every supported version of both Debian _and_ Ubuntu have 2.2.x 😇). --- 5.7/Dockerfile.debian | 2 +- 8.0/Dockerfile.debian | 2 +- template/Dockerfile.debian | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian index 3aa33e91d..8153f43d7 100644 --- a/5.7/Dockerfile.debian +++ b/5.7/Dockerfile.debian @@ -9,7 +9,7 @@ FROM debian:buster-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql -RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf /var/lib/apt/lists/* # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 3408336e4..e5af6517c 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -9,7 +9,7 @@ FROM debian:bullseye-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql -RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf /var/lib/apt/lists/* # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index 14d00278f..9caae222d 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -3,7 +3,7 @@ FROM debian:{{ .debian.suite }}-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql -RUN apt-get update && apt-get install -y --no-install-recommends gnupg dirmngr && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf /var/lib/apt/lists/* # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases From 9fbbc18ee6b5efaca983cf609eb686f0a1211178 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 3 Jul 2023 11:09:15 -0700 Subject: [PATCH 207/285] Add "suite aliases" ("-oraclelinux8", "-bullseye", etc) --- generate-stackbrew-library.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index cbf4cecc1..e3c6672e6 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -79,17 +79,33 @@ for version; do ) for variant in oracle debian; do + export variant + df="Dockerfile.$variant" commit="$(dirCommit "$version" "$df")" variantAliases=( "${versionAliases[@]/%/-$variant}" ) variantAliases=( "${variantAliases[@]//latest-/}" ) + + case "$variant" in + debian) + suite="$(jq -r '.[env.version][env.variant].suite' versions.json)" + variantAliases=( "${versionAliases[@]/%/-$suite}" "${variantAliases[@]}" ) + variantAliases=( "${variantAliases[@]//latest-/}" ) + ;; + + oracle) + ol="$(jq -r '.[env.version][env.variant].variant | split("-")[0]' versions.json)" + variantAliases=( "${versionAliases[@]/%/-oraclelinux$ol}" "${variantAliases[@]}" ) + variantAliases=( "${variantAliases[@]//latest-/}" ) + ;; + esac + if [ "$variant" = "$defaultVariant" ]; then variantAliases=( "${versionAliases[@]}" "${variantAliases[@]}" ) fi # TODO if the list of architectures supported by MySQL ever is greater than that of the base image it's FROM, this list will need to be filtered - export variant variantArches="$(jq -r '.[env.version][env.variant].architectures | join(", ")' versions.json)" echo From f4030aebf6a63d640f7085fb3e4601b4e70313c8 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Thu, 20 Jul 2023 15:15:44 -0700 Subject: [PATCH 208/285] Update 8.0 to 8.0.34, debian 8.0.34-1debian11, mysql-shell 8.0.34-1.el8, oracle 8.0.34-1.el8 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index e5af6517c..ae7257bc1 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -63,7 +63,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.33-1debian11 +ENV MYSQL_VERSION 8.0.34-1debian11 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bullseye mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index b71470d5b..0a843c849 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.33-1.el8 +ENV MYSQL_VERSION 8.0.34-1.el8 RUN set -eu; \ . /etc/os-release; \ @@ -106,7 +106,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.33-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.34-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 2bb764602..e453946a0 100644 --- a/versions.json +++ b/versions.json @@ -25,10 +25,10 @@ "amd64" ], "suite": "bullseye", - "version": "8.0.33-1debian11" + "version": "8.0.34-1debian11" }, "mysql-shell": { - "version": "8.0.33-1.el8" + "version": "8.0.34-1.el8" }, "oracle": { "architectures": [ @@ -36,8 +36,8 @@ "arm64v8" ], "variant": "8-slim", - "version": "8.0.33-1.el8" + "version": "8.0.34-1.el8" }, - "version": "8.0.33" + "version": "8.0.34" } } From 2baf92d30620d7d123141b98988b0d42d2156351 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Fri, 21 Jul 2023 03:15:11 -0700 Subject: [PATCH 209/285] Update 5.7 to mysql-shell 8.0.34-1.el7 --- 5.7/Dockerfile.oracle | 2 +- versions.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 8cf9189ba..38169b98e 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -115,7 +115,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.33-1.el7 +ENV MYSQL_SHELL_VERSION 8.0.34-1.el7 RUN set -eux; \ yum install -y --setopt=skip_missing_names_on_install=False "mysql-shell-$MYSQL_SHELL_VERSION"; \ yum clean all; \ diff --git a/versions.json b/versions.json index e453946a0..cc0ac3d47 100644 --- a/versions.json +++ b/versions.json @@ -8,7 +8,7 @@ "version": "5.7.42-1debian10" }, "mysql-shell": { - "version": "8.0.33-1.el7" + "version": "8.0.34-1.el7" }, "oracle": { "architectures": [ From 18afafd96b3bff0bc687268613c0ad3549041b9a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 24 Jul 2023 16:08:25 -0700 Subject: [PATCH 210/285] Add very crude parsing of "repomd.xml" This gives us more accurate version scraping that's not reliant on the cache of the HTML file listing (which instead matches how `yum`/`dnf` query these version numbers, so should stay in sync better). This should fix our issues with CI sometimes returning a mismatch in 8.0 versions. **However**, this *causes* a mismatch in 5.7 versions because the latest 5.7 release (that we were not picking up before due to the aforementioned HTML caching but are now with this updated code) is apparently not built/released for Debian (https://dev.mysql.com/downloads/mysql/), so we also need to decide whether we're going to introduce Debian/Oracle version skew or perhaps deprecate/remove the Debian variants of 5.7 (which is ostensibly EOL in ~3 months). --- versions.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/versions.sh b/versions.sh index 3f8fa0fc6..9814a3155 100755 --- a/versions.sh +++ b/versions.sh @@ -23,7 +23,28 @@ fetch_rpm_versions() { local oracleVersion="$1"; shift local package="$1"; shift - curl -fsSL "$repo/$arch/" 2>/dev/null \ + local baseurl="$repo/$arch" + + # *technically*, we should parse "repodata/repomd.xml", look for , and use the value out of it, but parsing XML is not trivial with only basic tools, it turns out, so instead we rely on MySQL's use of "*-primary.xml.*" as the filename we're after 👀 + local primaryLocation + primaryLocation="$( + # 2>/dev/null in case "$arch" doesn't exist in "$repo" 🙈 + curl -fsSL "$baseurl/repodata/repomd.xml" 2>/dev/null \ + | grep -oE 'href="[^"]+-primary[.]xml([.]gz)?"' \ + | cut -d'"' -f2 + )" || return 1 + [ -n "$primaryLocation" ] || return 1 + + local decompressor='cat' + case "$primaryLocation" in + *.gz) decompressor='gunzip' ;; + *.xml) ;; + *) echo >&2 "error: unknown compression (from '$baseurl'): $primaryLocation"; exit 1 ;; + esac + + # again, *technically* we should properly parse XML here, but y'know, it's complicated + curl -fsSL "$baseurl/$primaryLocation" \ + | "$decompressor" \ | grep -oE '"'"$package"'-[0-9][^"]+[.]el'"$oracleVersion"'[.]'"$arch"'[.]rpm"' \ | sed -r 's/^"'"$package-|[.]$arch[.]rpm"'"$//g' \ | sort -rV @@ -111,6 +132,10 @@ for version in "${versions[@]}"; do export bashbrewArch doc="$(jq <<<"$doc" -c '.oracle.architectures = (.oracle.architectures + [ env.bashbrewArch ] | sort)')" done + if [ -z "$rpmVersion" ]; then + echo >&2 "error: missing version for '$version'" + exit 1 + fi baseVersion="$(jq <<<"$doc" -r '.version // ""')" # example 8.0.22-1.el7 => 8.0.22 oracleBaseVersion="${rpmVersion%-*}" From eb1850601849ef7ef77a23f017a20debc95d597c Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 27 Jul 2023 14:49:47 -0700 Subject: [PATCH 211/285] Add innovation (8.1.0) --- generate-stackbrew-library.sh | 12 +- innovation/Dockerfile.oracle | 122 +++++++++ innovation/docker-entrypoint.sh | 437 ++++++++++++++++++++++++++++++++ versions.json | 14 + versions.sh | 1 - 5 files changed, 580 insertions(+), 6 deletions(-) create mode 100644 innovation/Dockerfile.oracle create mode 100755 innovation/docker-entrypoint.sh diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index cbf4cecc1..8c01d4ac7 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -3,7 +3,7 @@ set -Eeuo pipefail declare -A aliases=( [5.7]='5' - [8.0]='8 latest' + [innovation]='latest' ) defaultDefaultVariant='oracle' @@ -73,13 +73,15 @@ for version; do versionAliases+=( $fullVersion ) fullVersion="${fullVersion%[.-]*}" done - versionAliases+=( - $version - ${aliases[$version]:-} - ) + versionAliases+=( $fullVersion ) + if [ "$version" != "$fullVersion" ]; then + versionAliases+=( $version ) + fi + versionAliases+=( ${aliases[$version]:-} ) for variant in oracle debian; do df="Dockerfile.$variant" + [ -s "$version/$df" ] || continue commit="$(dirCommit "$version" "$df")" variantAliases=( "${versionAliases[@]/%/-$variant}" ) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle new file mode 100644 index 000000000..f6cff6f6b --- /dev/null +++ b/innovation/Dockerfile.oracle @@ -0,0 +1,122 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM oraclelinux:8-slim + +RUN set -eux; \ + groupadd --system --gid 999 mysql; \ + useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql + +# add gosu for easy step-down from root +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.16 +RUN set -eux; \ +# TODO find a better userspace architecture detection method than querying the kernel + arch="$(uname -m)"; \ + case "$arch" in \ + aarch64) gosuArch='arm64' ;; \ + x86_64) gosuArch='amd64' ;; \ + *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ + esac; \ + curl -fL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch.asc"; \ + curl -fL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true + +RUN set -eux; \ + microdnf install -y \ + bzip2 \ + gzip \ + openssl \ + xz \ + zstd \ +# Oracle Linux 8+ is very slim :) + findutils \ + ; \ + microdnf clean all + +RUN set -eux; \ +# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html +# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported + key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ + rm -rf "$GNUPGHOME" + +ENV MYSQL_MAJOR innovation +ENV MYSQL_VERSION 8.1.0-1.el8 + +RUN set -eu; \ + . /etc/os-release; \ + { \ + echo '[mysqlinnovation-server-minimal]'; \ + echo 'name=MySQL innovation Server Minimal'; \ + echo 'enabled=1'; \ + echo "baseurl=https://repo.mysql.com/yum/mysql-innovation-community/docker/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-minimal.repo + +RUN set -eux; \ + microdnf install -y "mysql-community-server-minimal-$MYSQL_VERSION"; \ + microdnf clean all; \ +# the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead) +# https://github.com/docker-library/mysql/pull/680#issuecomment-636121520 + grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ + sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ + grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ + { echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf; \ + \ +# make sure users dumping files in "/etc/mysql/conf.d" still works + ! grep -F '!includedir' /etc/my.cnf; \ + { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ + mkdir -p /etc/mysql/conf.d; \ +# ensure these directories exist and have useful permissions +# the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install + mkdir -p /var/lib/mysql /var/run/mysqld; \ + chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + chmod 1777 /var/lib/mysql /var/run/mysqld; \ + \ + mkdir /docker-entrypoint-initdb.d; \ + \ + mysqld --version; \ + mysql --version + +RUN set -eu; \ + . /etc/os-release; \ + { \ + echo '[mysql-tools-community]'; \ + echo 'name=MySQL Tools Community'; \ + echo "baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'enabled=1'; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-tools.repo +ENV MYSQL_SHELL_VERSION 8.0.34-1.el8 +RUN set -eux; \ + microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ + microdnf clean all; \ + \ + mysqlsh --version + +VOLUME /var/lib/mysql + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 3306 33060 +CMD ["mysqld"] diff --git a/innovation/docker-entrypoint.sh b/innovation/docker-entrypoint.sh new file mode 100755 index 000000000..6ce3baea8 --- /dev/null +++ b/innovation/docker-entrypoint.sh @@ -0,0 +1,437 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +# logging functions +mysql_log() { + local type="$1"; shift + # accept argument string or stdin + local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi + local dt; dt="$(date --rfc-3339=seconds)" + printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text" +} +mysql_note() { + mysql_log Note "$@" +} +mysql_warn() { + mysql_log Warn "$@" >&2 +} +mysql_error() { + mysql_log ERROR "$@" >&2 + exit 1 +} + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + mysql_error "Both $var and $fileVar are set (but are exclusive)" + fi + local val="$def" + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + export "$var"="$val" + unset "$fileVar" +} + +# check to see if this file is being run or sourced from another script +_is_sourced() { + # https://unix.stackexchange.com/a/215279 + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] +} + +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions +docker_process_init_files() { + # mysql here for backwards compatibility "${mysql[@]}" + mysql=( docker_process_sql ) + + echo + local f + for f; do + case "$f" in + *.sh) + # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 + # https://github.com/docker-library/postgres/pull/452 + if [ -x "$f" ]; then + mysql_note "$0: running $f" + "$f" + else + mysql_note "$0: sourcing $f" + . "$f" + fi + ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.bz2) mysql_note "$0: running $f"; bunzip2 -c "$f" | docker_process_sql; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; + *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; + *) mysql_warn "$0: ignoring $f" ;; + esac + echo + done +} + +# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) +_verboseHelpArgs=( + --verbose --help + --log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136 +) + +mysql_check_config() { + local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors + if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then + mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" + fi +} + +# Fetch value from server config +# We use mysqld --verbose --help instead of my_print_defaults because the +# latter only show values present in config files, and not server defaults +mysql_get_config() { + local conf="$1"; shift + "$@" "${_verboseHelpArgs[@]}" 2>/dev/null \ + | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" +} + +# Ensure that the package default socket can also be used +# since rpm packages are compiled with a different socket location +# and "mysqlsh --mysql" doesn't read the [client] config +# related to https://github.com/docker-library/mysql/issues/829 +mysql_socket_fix() { + local defaultSocket + defaultSocket="$(mysql_get_config 'socket' mysqld --no-defaults)" + if [ "$defaultSocket" != "$SOCKET" ]; then + ln -sfTv "$SOCKET" "$defaultSocket" || : + fi +} + +# Do a temporary startup of the MySQL server, for init purposes +docker_temp_server_start() { + if [ "${MYSQL_MAJOR}" = '5.7' ]; then + "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & + mysql_note "Waiting for server startup" + local i + for i in {30..0}; do + # only use the root password if the database has already been initialized + # so that it won't try to fill in a password file when it hasn't been set yet + extraArgs=() + if [ -z "$DATABASE_ALREADY_EXISTS" ]; then + extraArgs+=( '--dont-use-mysql-root-password' ) + fi + if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then + break + fi + sleep 1 + done + if [ "$i" = 0 ]; then + mysql_error "Unable to start server." + fi + else + # For 5.7+ the server is ready for use as soon as startup command unblocks + if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then + mysql_error "Unable to start server." + fi + fi +} + +# Stop the server. When using a local socket file mysqladmin will block until +# the shutdown is complete. +docker_temp_server_stop() { + if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then + mysql_error "Unable to shut down server." + fi +} + +# Verify that the minimally required password settings are set for new databases. +docker_verify_minimum_env() { + if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + mysql_error <<-'EOF' + Database is uninitialized and password option is not specified + You need to specify one of the following as an environment variable: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) + if [ "$MYSQL_USER" = 'root' ]; then + mysql_error <<-'EOF' + MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user + Remove MYSQL_USER="root" and use one of the following to control the root user password: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # warn when missing one of MYSQL_USER or MYSQL_PASSWORD + if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created' + elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored' + fi +} + +# creates folders for the database +# also ensures permission for user mysql of run as root +docker_create_db_directories() { + local user; user="$(id -u)" + + local -A dirs=( ["$DATADIR"]=1 ) + local dir + dir="$(dirname "$SOCKET")" + dirs["$dir"]=1 + + # "datadir" and "socket" are already handled above (since they were already queried previously) + local conf + for conf in \ + general-log-file \ + keyring_file_data \ + pid-file \ + secure-file-priv \ + slow-query-log-file \ + ; do + dir="$(mysql_get_config "$conf" "$@")" + + # skip empty values + if [ -z "$dir" ] || [ "$dir" = 'NULL' ]; then + continue + fi + case "$conf" in + secure-file-priv) + # already points at a directory + ;; + *) + # other config options point at a file, but we need the directory + dir="$(dirname "$dir")" + ;; + esac + + dirs["$dir"]=1 + done + + mkdir -p "${!dirs[@]}" + + if [ "$user" = "0" ]; then + # this will cause less disk access than `chown -R` + find "${!dirs[@]}" \! -user mysql -exec chown --no-dereference mysql '{}' + + fi +} + +# initializes the database directory +docker_init_database_dir() { + mysql_note "Initializing database files" + "$@" --initialize-insecure --default-time-zone=SYSTEM + mysql_note "Database files initialized" +} + +# Loads various settings that are used elsewhere in the script +# This should be called after mysql_check_config, but before any other functions +docker_setup_env() { + # Get config + declare -g DATADIR SOCKET + DATADIR="$(mysql_get_config 'datadir' "$@")" + SOCKET="$(mysql_get_config 'socket' "$@")" + + # Initialize values that might be stored in a file + file_env 'MYSQL_ROOT_HOST' '%' + file_env 'MYSQL_DATABASE' + file_env 'MYSQL_USER' + file_env 'MYSQL_PASSWORD' + file_env 'MYSQL_ROOT_PASSWORD' + + declare -g DATABASE_ALREADY_EXISTS + if [ -d "$DATADIR/mysql" ]; then + DATABASE_ALREADY_EXISTS='true' + fi +} + +# Execute sql script, passed via stdin +# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args] +# ie: docker_process_sql --database=mydb <<<'INSERT ...' +# ie: docker_process_sql --dont-use-mysql-root-password --database=mydb /dev/null + + docker_init_database_dir "$@" + + mysql_note "Starting temporary server" + docker_temp_server_start "$@" + mysql_note "Temporary server started." + + mysql_socket_fix + docker_setup_db + docker_process_init_files /docker-entrypoint-initdb.d/* + + mysql_expire_root_user + + mysql_note "Stopping temporary server" + docker_temp_server_stop + mysql_note "Temporary server stopped" + + echo + mysql_note "MySQL init process done. Ready for start up." + echo + else + mysql_socket_fix + fi + fi + exec "$@" +} + +# If we are sourced from elsewhere, don't perform any further actions +if ! _is_sourced; then + _main "$@" +fi diff --git a/versions.json b/versions.json index cc0ac3d47..4aa4457d5 100644 --- a/versions.json +++ b/versions.json @@ -39,5 +39,19 @@ "version": "8.0.34-1.el8" }, "version": "8.0.34" + }, + "innovation": { + "mysql-shell": { + "version": "8.0.34-1.el8" + }, + "oracle": { + "architectures": [ + "amd64", + "arm64v8" + ], + "variant": "8-slim", + "version": "8.1.0-1.el8" + }, + "version": "8.1.0" } } diff --git a/versions.sh b/versions.sh index 9814a3155..8f5a2054b 100755 --- a/versions.sh +++ b/versions.sh @@ -110,7 +110,6 @@ for version in "${versions[@]}"; do rpmRepo="https://repo.mysql.com/yum/mysql-$version-community/docker/el/$oracleVersion" archVersions="$( fetch_rpm_versions "$rpmRepo" "$rpmArch" "$oracleVersion" 'mysql-community-server-minimal' \ - | grep -E "^$version[.]" \ || : )" archVersion="$(head -1 <<<"$archVersions")" From c13cda9c2c9d836af9b3331e8681f8cc8e0a7803 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 27 Jul 2023 14:56:07 -0700 Subject: [PATCH 212/285] Update 5.7 to 5.7.43, dropping Debian support Upstream no longer supports Debian for the 5.7 series, so we follow suit. --- 5.7/Dockerfile.debian | 100 ------------------------------------------ 5.7/Dockerfile.oracle | 2 +- apply-templates.sh | 2 + versions.json | 11 +---- versions.sh | 5 ++- 5 files changed, 8 insertions(+), 112 deletions(-) delete mode 100644 5.7/Dockerfile.debian diff --git a/5.7/Dockerfile.debian b/5.7/Dockerfile.debian deleted file mode 100644 index 8153f43d7..000000000 --- a/5.7/Dockerfile.debian +++ /dev/null @@ -1,100 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:buster-slim - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN groupadd -r mysql && useradd -r -g mysql mysql - -RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf /var/lib/apt/lists/* - -# add gosu for easy step-down from root -# https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.16 -RUN set -eux; \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends ca-certificates wget; \ - rm -rf /var/lib/apt/lists/*; \ - dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ - wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ - wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ - gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - chmod +x /usr/local/bin/gosu; \ - gosu --version; \ - gosu nobody true - -RUN mkdir /docker-entrypoint-initdb.d - -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - bzip2 \ - openssl \ -# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: -# File::Basename -# File::Copy -# Sys::Hostname -# Data::Dumper - perl \ - xz-utils \ - zstd \ - ; \ - rm -rf /var/lib/apt/lists/* - -RUN set -eux; \ -# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported - key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - mkdir -p /etc/apt/keyrings; \ - gpg --batch --export "$key" > /etc/apt/keyrings/mysql.gpg; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME" - -ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.42-1debian10 - -RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ buster mysql-5.7' > /etc/apt/sources.list.d/mysql.list - -# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) -# also, we set debconf keys to make APT a little quieter -RUN { \ - echo mysql-community-server mysql-community-server/data-dir select ''; \ - echo mysql-community-server mysql-community-server/root-pass password ''; \ - echo mysql-community-server mysql-community-server/re-root-pass password ''; \ - echo mysql-community-server mysql-community-server/remove-test-db select false; \ - } | debconf-set-selections \ - && apt-get update \ - && apt-get install -y \ - mysql-server="${MYSQL_VERSION}" \ -# comment out a few problematic configuration values - && find /etc/mysql/ -name '*.cnf' -print0 \ - | xargs -0 grep -lZE '^(bind-address|log)' \ - | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \ -# don't reverse lookup hostnames, they are usually another container - && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ - && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 1777 /var/run/mysqld /var/lib/mysql - -VOLUME /var/lib/mysql - -COPY docker-entrypoint.sh /usr/local/bin/ -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -EXPOSE 3306 33060 -CMD ["mysqld"] diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 38169b98e..07a3a703f 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.42-1.el7 +ENV MYSQL_VERSION 5.7.43-1.el7 RUN set -eu; \ . /etc/os-release; \ diff --git a/apply-templates.sh b/apply-templates.sh index 05db7e521..ee553ff8f 100755 --- a/apply-templates.sh +++ b/apply-templates.sh @@ -32,6 +32,8 @@ generated_warning() { for version; do export version + rm -f "$version"/Dockerfile.* + for variant in oracle debian; do export variant diff --git a/versions.json b/versions.json index 4aa4457d5..b5a8fad25 100644 --- a/versions.json +++ b/versions.json @@ -1,12 +1,5 @@ { "5.7": { - "debian": { - "architectures": [ - "amd64" - ], - "suite": "buster", - "version": "5.7.42-1debian10" - }, "mysql-shell": { "version": "8.0.34-1.el7" }, @@ -15,9 +8,9 @@ "amd64" ], "variant": "7-slim", - "version": "5.7.42-1.el7" + "version": "5.7.43-1.el7" }, - "version": "5.7.42" + "version": "5.7.43" }, "8.0": { "debian": { diff --git a/versions.sh b/versions.sh index 8f5a2054b..a76f2b1a7 100755 --- a/versions.sh +++ b/versions.sh @@ -54,7 +54,7 @@ cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" versions=( "$@" ) if [ ${#versions[@]} -eq 0 ]; then - versions=( *.*/ ) + versions=( */ ) json='{}' else json="$(< versions.json)" @@ -62,11 +62,12 @@ fi versions=( "${versions[@]%/}" ) for version in "${versions[@]}"; do + [ "$version" != 'template' ] || continue export version doc='{}' - if [[ "$version" == 5.* ]] || [ "$version" = '8.0' ]; then + if [ "$version" = '8.0' ]; then debianSuite="${debianSuites[$version]:-$defaultDebianSuite}" debianVersion="$( curl -fsSL "https://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ From 9678ed1d27794ae9529c43b4411e30f981ce39ea Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 24 Oct 2023 09:15:11 -0700 Subject: [PATCH 213/285] Update 5.7 to 5.7.44, mysql-shell 8.0.35-1.el7, oracle 5.7.44-1.el7 --- 5.7/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 07a3a703f..34dd84877 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.43-1.el7 +ENV MYSQL_VERSION 5.7.44-1.el7 RUN set -eu; \ . /etc/os-release; \ @@ -115,7 +115,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.34-1.el7 +ENV MYSQL_SHELL_VERSION 8.0.35-1.el7 RUN set -eux; \ yum install -y --setopt=skip_missing_names_on_install=False "mysql-shell-$MYSQL_SHELL_VERSION"; \ yum clean all; \ diff --git a/versions.json b/versions.json index b5a8fad25..f32055939 100644 --- a/versions.json +++ b/versions.json @@ -1,16 +1,16 @@ { "5.7": { "mysql-shell": { - "version": "8.0.34-1.el7" + "version": "8.0.35-1.el7" }, "oracle": { "architectures": [ "amd64" ], "variant": "7-slim", - "version": "5.7.43-1.el7" + "version": "5.7.44-1.el7" }, - "version": "5.7.43" + "version": "5.7.44" }, "8.0": { "debian": { From 84ba05eaa75e1f0e1d33185e23f95a9cdc607b51 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 24 Oct 2023 09:18:19 -0700 Subject: [PATCH 214/285] Update 8.0 to 8.0.35, debian 8.0.35-1debian11, mysql-shell 8.0.35-1.el8, oracle 8.0.35-1.el8 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index ae7257bc1..dd18532eb 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -63,7 +63,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.34-1debian11 +ENV MYSQL_VERSION 8.0.35-1debian11 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bullseye mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 0a843c849..dedf8edbf 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.34-1.el8 +ENV MYSQL_VERSION 8.0.35-1.el8 RUN set -eu; \ . /etc/os-release; \ @@ -106,7 +106,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.34-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.35-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index f32055939..83db57e68 100644 --- a/versions.json +++ b/versions.json @@ -18,10 +18,10 @@ "amd64" ], "suite": "bullseye", - "version": "8.0.34-1debian11" + "version": "8.0.35-1debian11" }, "mysql-shell": { - "version": "8.0.34-1.el8" + "version": "8.0.35-1.el8" }, "oracle": { "architectures": [ @@ -29,9 +29,9 @@ "arm64v8" ], "variant": "8-slim", - "version": "8.0.34-1.el8" + "version": "8.0.35-1.el8" }, - "version": "8.0.34" + "version": "8.0.35" }, "innovation": { "mysql-shell": { From 76806cdd0acee2dec39b1b66e9c8015ef75be196 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 24 Oct 2023 09:24:49 -0700 Subject: [PATCH 215/285] Update innovation to 8.2.0, mysql-shell 8.0.35-1.el8, oracle 8.2.0-1.el8 --- innovation/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index f6cff6f6b..2ae20b8f7 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -53,7 +53,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 8.1.0-1.el8 +ENV MYSQL_VERSION 8.2.0-1.el8 RUN set -eu; \ . /etc/os-release; \ @@ -106,7 +106,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.34-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.35-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 83db57e68..bca7bcd99 100644 --- a/versions.json +++ b/versions.json @@ -35,7 +35,7 @@ }, "innovation": { "mysql-shell": { - "version": "8.0.34-1.el8" + "version": "8.0.35-1.el8" }, "oracle": { "architectures": [ @@ -43,8 +43,8 @@ "arm64v8" ], "variant": "8-slim", - "version": "8.1.0-1.el8" + "version": "8.2.0-1.el8" }, - "version": "8.1.0" + "version": "8.2.0" } } From dc35beded3a41c4c62dfaa7f86ea5721c02a2e8b Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Tue, 7 Nov 2023 20:46:18 -0400 Subject: [PATCH 216/285] Fix skip-host-cache deprecation warning (#1002) skip-host-cache was deprecated in 8.0.30 and replaced by a configurable host_cache_size https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-30.html#mysqld-8-0-30-deprecation-removal --- 8.0/config/conf.d/docker.cnf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/8.0/config/conf.d/docker.cnf b/8.0/config/conf.d/docker.cnf index 4f1829d66..205bedb54 100644 --- a/8.0/config/conf.d/docker.cnf +++ b/8.0/config/conf.d/docker.cnf @@ -1,3 +1,3 @@ [mysqld] -skip-host-cache +host_cache_size=0 skip-name-resolve From 0097ab8a1fde788a9a51357339fa5498855623e2 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 11 Dec 2023 14:11:00 -0800 Subject: [PATCH 217/285] Update tools repo handling and update innovation to mysql-shell 8.2.1 The "innovation" branch of MySQL appears to have a separate tools repository now with newer versions of MySQL Shell. --- 5.7/Dockerfile.oracle | 6 ++---- 8.0/Dockerfile.oracle | 6 ++---- apply-templates.sh | 6 +++++- innovation/Dockerfile.oracle | 8 +++----- template/Dockerfile.oracle | 6 ++---- versions.json | 8 +++++++- versions.sh | 20 +++++++++++++++----- 7 files changed, 36 insertions(+), 24 deletions(-) diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle index 34dd84877..9f1f8bb4a 100644 --- a/5.7/Dockerfile.oracle +++ b/5.7/Dockerfile.oracle @@ -56,12 +56,11 @@ ENV MYSQL_MAJOR 5.7 ENV MYSQL_VERSION 5.7.44-1.el7 RUN set -eu; \ - . /etc/os-release; \ { \ echo '[mysql5.7-server-minimal]'; \ echo 'name=MySQL 5.7 Server Minimal'; \ echo 'enabled=1'; \ - echo "baseurl=https://repo.mysql.com/yum/mysql-5.7-community/docker/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-5.7-community/docker/el/7/$basearch/'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 @@ -104,11 +103,10 @@ RUN set -eux; \ mysql --version RUN set -eu; \ - . /etc/os-release; \ { \ echo '[mysql-tools-community]'; \ echo 'name=MySQL Tools Community'; \ - echo "baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/'; \ echo 'enabled=1'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index dedf8edbf..0bc9653e3 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,12 +56,11 @@ ENV MYSQL_MAJOR 8.0 ENV MYSQL_VERSION 8.0.35-1.el8 RUN set -eu; \ - . /etc/os-release; \ { \ echo '[mysql8.0-server-minimal]'; \ echo 'name=MySQL 8.0 Server Minimal'; \ echo 'enabled=1'; \ - echo "baseurl=https://repo.mysql.com/yum/mysql-8.0-community/docker/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8/$basearch/'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 @@ -95,11 +94,10 @@ RUN set -eux; \ mysql --version RUN set -eu; \ - . /etc/os-release; \ { \ echo '[mysql-tools-community]'; \ echo 'name=MySQL Tools Community'; \ - echo "baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/8/$basearch/'; \ echo 'enabled=1'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ diff --git a/apply-templates.sh b/apply-templates.sh index ee553ff8f..3c84529ab 100755 --- a/apply-templates.sh +++ b/apply-templates.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash set -Eeuo pipefail +shopt -s extglob # support globs like !(foo) [ -f versions.json ] # run "versions.sh" first @@ -32,11 +33,14 @@ generated_warning() { for version; do export version - rm -f "$version"/Dockerfile.* + rm -f "$version"/!(config) + mkdir -p "$version" for variant in oracle debian; do export variant + echo "processing $version ($variant) ..." + variantVersion="$(jq -r '.[env.version][env.variant] // {} | .version // ""' versions.json)" if [ -n "$variantVersion" ]; then dockerfile="Dockerfile.$variant" diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 2ae20b8f7..334a3d00a 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -56,12 +56,11 @@ ENV MYSQL_MAJOR innovation ENV MYSQL_VERSION 8.2.0-1.el8 RUN set -eu; \ - . /etc/os-release; \ { \ echo '[mysqlinnovation-server-minimal]'; \ echo 'name=MySQL innovation Server Minimal'; \ echo 'enabled=1'; \ - echo "baseurl=https://repo.mysql.com/yum/mysql-innovation-community/docker/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8/$basearch/'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 @@ -95,18 +94,17 @@ RUN set -eux; \ mysql --version RUN set -eu; \ - . /etc/os-release; \ { \ echo '[mysql-tools-community]'; \ echo 'name=MySQL Tools Community'; \ - echo "baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8/$basearch/'; \ echo 'enabled=1'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.35-1.el8 +ENV MYSQL_SHELL_VERSION 8.2.1-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index 1027d4466..c4e2c74de 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -71,12 +71,11 @@ ENV MYSQL_MAJOR {{ env.version }} ENV MYSQL_VERSION {{ .oracle.version }} RUN set -eu; \ - . /etc/os-release; \ { \ echo '[mysql{{ env.version }}-server-minimal]'; \ echo 'name=MySQL {{ env.version }} Server Minimal'; \ echo 'enabled=1'; \ - echo "baseurl=https://repo.mysql.com/yum/mysql-{{ env.version }}-community/docker/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo {{ "baseurl=" + .oracle.repo + "/$basearch/" | @sh }}; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 @@ -121,11 +120,10 @@ RUN set -eux; \ mysql --version RUN set -eu; \ - . /etc/os-release; \ { \ echo '[mysql-tools-community]'; \ echo 'name=MySQL Tools Community'; \ - echo "baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/${VERSION_ID%%[.-]*}/\$basearch/"; \ + echo {{ "baseurl=" + .["mysql-shell"].repo + "/$basearch/" | @sh }}; \ echo 'enabled=1'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ diff --git a/versions.json b/versions.json index bca7bcd99..f4fba08cc 100644 --- a/versions.json +++ b/versions.json @@ -1,12 +1,14 @@ { "5.7": { "mysql-shell": { + "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/7", "version": "8.0.35-1.el7" }, "oracle": { "architectures": [ "amd64" ], + "repo": "https://repo.mysql.com/yum/mysql-5.7-community/docker/el/7", "variant": "7-slim", "version": "5.7.44-1.el7" }, @@ -21,6 +23,7 @@ "version": "8.0.35-1debian11" }, "mysql-shell": { + "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8", "version": "8.0.35-1.el8" }, "oracle": { @@ -28,6 +31,7 @@ "amd64", "arm64v8" ], + "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8", "variant": "8-slim", "version": "8.0.35-1.el8" }, @@ -35,13 +39,15 @@ }, "innovation": { "mysql-shell": { - "version": "8.0.35-1.el8" + "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8", + "version": "8.2.1-1.el8" }, "oracle": { "architectures": [ "amd64", "arm64v8" ], + "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8", "variant": "8-slim", "version": "8.2.0-1.el8" }, diff --git a/versions.sh b/versions.sh index a76f2b1a7..6fd12dfa9 100755 --- a/versions.sh +++ b/versions.sh @@ -103,12 +103,22 @@ for version in "${versions[@]}"; do oracleVariant="${oracleVariants[$version]:-$defaultOracleVariant}" oracleVersion="${oracleVariant%%-*}" # "7", etc + + rpmRepo="https://repo.mysql.com/yum/mysql-$version-community/docker/el/$oracleVersion" + case "$version" in + innovation) toolsRepo="https://repo.mysql.com/yum/mysql-tools-innovation-community/el/$oracleVersion" ;; + *) toolsRepo="https://repo.mysql.com/yum/mysql-tools-community/el/$oracleVersion" ;; + esac + export rpmRepo toolsRepo + rpmVersion= shellVersion= - doc="$(jq <<<"$doc" -c '. += { oracle: { architectures: [] } }')" + doc="$(jq <<<"$doc" -c '. += { + oracle: { architectures: [], repo: env.rpmRepo }, + "mysql-shell": { repo: env.toolsRepo }, + }')" for bashbrewArch in $(xargs -n1 <<<"${!bashbrewArchToRpmArch[*]}" | sort | xargs); do rpmArch="${bashbrewArchToRpmArch[$bashbrewArch]}" - rpmRepo="https://repo.mysql.com/yum/mysql-$version-community/docker/el/$oracleVersion" archVersions="$( fetch_rpm_versions "$rpmRepo" "$rpmArch" "$oracleVersion" 'mysql-community-server-minimal' \ || : @@ -121,7 +131,7 @@ for version in "${versions[@]}"; do echo >&2 "error: $version architecture version mismatch! ('$rpmVersion' vs '$archVersion' on '$rpmArch'/'$bashbrewArch')" exit 1 fi - shellArchVersions="$(fetch_rpm_versions "https://repo.mysql.com/yum/mysql-tools-community/el/$oracleVersion" "$rpmArch" "$oracleVersion" 'mysql-shell')" + shellArchVersions="$(fetch_rpm_versions "$toolsRepo" "$rpmArch" "$oracleVersion" 'mysql-shell')" shellArchVersion="$(head -1 <<<"$shellArchVersions")" if [ -z "$shellVersion" ]; then shellVersion="$shellArchVersion" @@ -152,9 +162,9 @@ for version in "${versions[@]}"; do version: env.rpmVersion, variant: env.oracleVariant, }), - "mysql-shell": { + "mysql-shell": (.["mysql-shell"] + { version: env.shellVersion, - }, + }), } ')" From d035567ee66d525cbf95b8dbc0be20e2f0a5e3f5 Mon Sep 17 00:00:00 2001 From: Joseph Ferguson Date: Fri, 15 Dec 2023 13:28:23 -0800 Subject: [PATCH 218/285] Add new upstream gpg key for Debian packages --- 8.0/Dockerfile.debian | 7 +++++-- template/Dockerfile.debian | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index dd18532eb..c231d2d62 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -53,8 +53,11 @@ RUN set -eux; \ rm -rf /var/lib/apt/lists/* RUN set -eux; \ -# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported - key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ +# pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] +# BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C +# uid [ unknown] MySQL Release Engineering +# sub rsa4096 2023-10-23 [E] [expires: 2025-10-22] + key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ mkdir -p /etc/apt/keyrings; \ diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index 9caae222d..b760a2e9e 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -47,8 +47,11 @@ RUN set -eux; \ rm -rf /var/lib/apt/lists/* RUN set -eux; \ -# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported - key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ +# pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] +# BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C +# uid [ unknown] MySQL Release Engineering +# sub rsa4096 2023-10-23 [E] [expires: 2025-10-22] + key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ mkdir -p /etc/apt/keyrings; \ From 3e959c224b965b0dd92a59a1dedeb7c34a24f550 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 18 Dec 2023 15:06:09 -0800 Subject: [PATCH 219/285] Remove 5.7 entirely (EOL) See https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-44.html > MySQL 5.7.44 is the final release of the MySQL 5.7 series. > > MySQL 5.7 users are encouraged to upgrade to the latest MySQL 8.0 or MySQL Innovation release. --- 5.7/Dockerfile.oracle | 130 ---------- 5.7/docker-entrypoint.sh | 437 -------------------------------- 8.0/docker-entrypoint.sh | 27 +- generate-stackbrew-library.sh | 2 - innovation/docker-entrypoint.sh | 27 +- template/Dockerfile.debian | 14 +- template/Dockerfile.oracle | 13 +- template/docker-entrypoint.sh | 27 +- versions.json | 15 -- versions.sh | 4 +- 10 files changed, 13 insertions(+), 683 deletions(-) delete mode 100644 5.7/Dockerfile.oracle delete mode 100755 5.7/docker-entrypoint.sh diff --git a/5.7/Dockerfile.oracle b/5.7/Dockerfile.oracle deleted file mode 100644 index 9f1f8bb4a..000000000 --- a/5.7/Dockerfile.oracle +++ /dev/null @@ -1,130 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM oraclelinux:7-slim - -RUN set -eux; \ - groupadd --system --gid 999 mysql; \ - useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql - -# add gosu for easy step-down from root -# https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.16 -RUN set -eux; \ -# TODO find a better userspace architecture detection method than querying the kernel - arch="$(uname -m)"; \ - case "$arch" in \ - aarch64) gosuArch='arm64' ;; \ - x86_64) gosuArch='amd64' ;; \ - *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ - esac; \ - curl -fL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch.asc"; \ - curl -fL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch"; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ - gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ - rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ - chmod +x /usr/local/bin/gosu; \ - gosu --version; \ - gosu nobody true - -RUN set -eux; \ -# https://github.com/docker-library/mysql/pull/871#issuecomment-1167954236 - yum install -y --setopt=skip_missing_names_on_install=False oracle-epel-release-el7; \ - yum install -y --setopt=skip_missing_names_on_install=False \ - bzip2 \ - gzip \ - openssl \ - xz \ - zstd \ - ; \ - yum clean all - -RUN set -eux; \ -# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html -# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported - key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ - rm -rf "$GNUPGHOME" - -ENV MYSQL_MAJOR 5.7 -ENV MYSQL_VERSION 5.7.44-1.el7 - -RUN set -eu; \ - { \ - echo '[mysql5.7-server-minimal]'; \ - echo 'name=MySQL 5.7 Server Minimal'; \ - echo 'enabled=1'; \ - echo 'baseurl=https://repo.mysql.com/yum/mysql-5.7-community/docker/el/7/$basearch/'; \ - echo 'gpgcheck=1'; \ - echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ -# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 - echo 'module_hotfixes=true'; \ - } | tee /etc/yum.repos.d/mysql-community-minimal.repo - -RUN set -eux; \ - yum install -y --setopt=skip_missing_names_on_install=False "mysql-community-server-minimal-$MYSQL_VERSION"; \ - yum clean all; \ -# the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead) -# https://github.com/docker-library/mysql/pull/680#issuecomment-636121520 - grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ - sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ - grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ - { echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf; \ - \ -# make sure users dumping files in "/etc/mysql/conf.d" still works - ! grep -F '!includedir' /etc/my.cnf; \ - { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ - mkdir -p /etc/mysql/conf.d; \ -# 5.7 Debian-based images also included "/etc/mysql/mysql.conf.d" so let's include it too - { echo '!includedir /etc/mysql/mysql.conf.d/'; } >> /etc/my.cnf; \ - mkdir -p /etc/mysql/mysql.conf.d; \ - \ -# comment out a few problematic configuration values - find /etc/my.cnf /etc/mysql/ -name '*.cnf' -print0 \ - | xargs -0 grep -lZE '^(bind-address|log)' \ - | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; \ - \ -# ensure these directories exist and have useful permissions -# the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install - mkdir -p /var/lib/mysql /var/run/mysqld; \ - chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - chmod 1777 /var/lib/mysql /var/run/mysqld; \ - \ - mkdir /docker-entrypoint-initdb.d; \ - \ - mysqld --version; \ - mysql --version - -RUN set -eu; \ - { \ - echo '[mysql-tools-community]'; \ - echo 'name=MySQL Tools Community'; \ - echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/'; \ - echo 'enabled=1'; \ - echo 'gpgcheck=1'; \ - echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ -# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 - echo 'module_hotfixes=true'; \ - } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.35-1.el7 -RUN set -eux; \ - yum install -y --setopt=skip_missing_names_on_install=False "mysql-shell-$MYSQL_SHELL_VERSION"; \ - yum clean all; \ - \ - mysqlsh --version - -VOLUME /var/lib/mysql - -COPY docker-entrypoint.sh /usr/local/bin/ -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -EXPOSE 3306 33060 -CMD ["mysqld"] diff --git a/5.7/docker-entrypoint.sh b/5.7/docker-entrypoint.sh deleted file mode 100755 index 6ce3baea8..000000000 --- a/5.7/docker-entrypoint.sh +++ /dev/null @@ -1,437 +0,0 @@ -#!/bin/bash -set -eo pipefail -shopt -s nullglob - -# logging functions -mysql_log() { - local type="$1"; shift - # accept argument string or stdin - local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi - local dt; dt="$(date --rfc-3339=seconds)" - printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text" -} -mysql_note() { - mysql_log Note "$@" -} -mysql_warn() { - mysql_log Warn "$@" >&2 -} -mysql_error() { - mysql_log ERROR "$@" >&2 - exit 1 -} - -# usage: file_env VAR [DEFAULT] -# ie: file_env 'XYZ_DB_PASSWORD' 'example' -# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of -# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) -file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - mysql_error "Both $var and $fileVar are set (but are exclusive)" - fi - local val="$def" - if [ "${!var:-}" ]; then - val="${!var}" - elif [ "${!fileVar:-}" ]; then - val="$(< "${!fileVar}")" - fi - export "$var"="$val" - unset "$fileVar" -} - -# check to see if this file is being run or sourced from another script -_is_sourced() { - # https://unix.stackexchange.com/a/215279 - [ "${#FUNCNAME[@]}" -ge 2 ] \ - && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ - && [ "${FUNCNAME[1]}" = 'source' ] -} - -# usage: docker_process_init_files [file [file [...]]] -# ie: docker_process_init_files /always-initdb.d/* -# process initializer files, based on file extensions -docker_process_init_files() { - # mysql here for backwards compatibility "${mysql[@]}" - mysql=( docker_process_sql ) - - echo - local f - for f; do - case "$f" in - *.sh) - # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 - # https://github.com/docker-library/postgres/pull/452 - if [ -x "$f" ]; then - mysql_note "$0: running $f" - "$f" - else - mysql_note "$0: sourcing $f" - . "$f" - fi - ;; - *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; - *.sql.bz2) mysql_note "$0: running $f"; bunzip2 -c "$f" | docker_process_sql; echo ;; - *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; - *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; - *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; - *) mysql_warn "$0: ignoring $f" ;; - esac - echo - done -} - -# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) -_verboseHelpArgs=( - --verbose --help - --log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136 -) - -mysql_check_config() { - local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors - if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" - fi -} - -# Fetch value from server config -# We use mysqld --verbose --help instead of my_print_defaults because the -# latter only show values present in config files, and not server defaults -mysql_get_config() { - local conf="$1"; shift - "$@" "${_verboseHelpArgs[@]}" 2>/dev/null \ - | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' - # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" -} - -# Ensure that the package default socket can also be used -# since rpm packages are compiled with a different socket location -# and "mysqlsh --mysql" doesn't read the [client] config -# related to https://github.com/docker-library/mysql/issues/829 -mysql_socket_fix() { - local defaultSocket - defaultSocket="$(mysql_get_config 'socket' mysqld --no-defaults)" - if [ "$defaultSocket" != "$SOCKET" ]; then - ln -sfTv "$SOCKET" "$defaultSocket" || : - fi -} - -# Do a temporary startup of the MySQL server, for init purposes -docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.7' ]; then - "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & - mysql_note "Waiting for server startup" - local i - for i in {30..0}; do - # only use the root password if the database has already been initialized - # so that it won't try to fill in a password file when it hasn't been set yet - extraArgs=() - if [ -z "$DATABASE_ALREADY_EXISTS" ]; then - extraArgs+=( '--dont-use-mysql-root-password' ) - fi - if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then - break - fi - sleep 1 - done - if [ "$i" = 0 ]; then - mysql_error "Unable to start server." - fi - else - # For 5.7+ the server is ready for use as soon as startup command unblocks - if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then - mysql_error "Unable to start server." - fi - fi -} - -# Stop the server. When using a local socket file mysqladmin will block until -# the shutdown is complete. -docker_temp_server_stop() { - if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then - mysql_error "Unable to shut down server." - fi -} - -# Verify that the minimally required password settings are set for new databases. -docker_verify_minimum_env() { - if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error <<-'EOF' - Database is uninitialized and password option is not specified - You need to specify one of the following as an environment variable: - - MYSQL_ROOT_PASSWORD - - MYSQL_ALLOW_EMPTY_PASSWORD - - MYSQL_RANDOM_ROOT_PASSWORD - EOF - fi - - # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) - if [ "$MYSQL_USER" = 'root' ]; then - mysql_error <<-'EOF' - MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user - Remove MYSQL_USER="root" and use one of the following to control the root user password: - - MYSQL_ROOT_PASSWORD - - MYSQL_ALLOW_EMPTY_PASSWORD - - MYSQL_RANDOM_ROOT_PASSWORD - EOF - fi - - # warn when missing one of MYSQL_USER or MYSQL_PASSWORD - if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then - mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created' - elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then - mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored' - fi -} - -# creates folders for the database -# also ensures permission for user mysql of run as root -docker_create_db_directories() { - local user; user="$(id -u)" - - local -A dirs=( ["$DATADIR"]=1 ) - local dir - dir="$(dirname "$SOCKET")" - dirs["$dir"]=1 - - # "datadir" and "socket" are already handled above (since they were already queried previously) - local conf - for conf in \ - general-log-file \ - keyring_file_data \ - pid-file \ - secure-file-priv \ - slow-query-log-file \ - ; do - dir="$(mysql_get_config "$conf" "$@")" - - # skip empty values - if [ -z "$dir" ] || [ "$dir" = 'NULL' ]; then - continue - fi - case "$conf" in - secure-file-priv) - # already points at a directory - ;; - *) - # other config options point at a file, but we need the directory - dir="$(dirname "$dir")" - ;; - esac - - dirs["$dir"]=1 - done - - mkdir -p "${!dirs[@]}" - - if [ "$user" = "0" ]; then - # this will cause less disk access than `chown -R` - find "${!dirs[@]}" \! -user mysql -exec chown --no-dereference mysql '{}' + - fi -} - -# initializes the database directory -docker_init_database_dir() { - mysql_note "Initializing database files" - "$@" --initialize-insecure --default-time-zone=SYSTEM - mysql_note "Database files initialized" -} - -# Loads various settings that are used elsewhere in the script -# This should be called after mysql_check_config, but before any other functions -docker_setup_env() { - # Get config - declare -g DATADIR SOCKET - DATADIR="$(mysql_get_config 'datadir' "$@")" - SOCKET="$(mysql_get_config 'socket' "$@")" - - # Initialize values that might be stored in a file - file_env 'MYSQL_ROOT_HOST' '%' - file_env 'MYSQL_DATABASE' - file_env 'MYSQL_USER' - file_env 'MYSQL_PASSWORD' - file_env 'MYSQL_ROOT_PASSWORD' - - declare -g DATABASE_ALREADY_EXISTS - if [ -d "$DATADIR/mysql" ]; then - DATABASE_ALREADY_EXISTS='true' - fi -} - -# Execute sql script, passed via stdin -# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args] -# ie: docker_process_sql --database=mydb <<<'INSERT ...' -# ie: docker_process_sql --dont-use-mysql-root-password --database=mydb /dev/null - - docker_init_database_dir "$@" - - mysql_note "Starting temporary server" - docker_temp_server_start "$@" - mysql_note "Temporary server started." - - mysql_socket_fix - docker_setup_db - docker_process_init_files /docker-entrypoint-initdb.d/* - - mysql_expire_root_user - - mysql_note "Stopping temporary server" - docker_temp_server_stop - mysql_note "Temporary server stopped" - - echo - mysql_note "MySQL init process done. Ready for start up." - echo - else - mysql_socket_fix - fi - fi - exec "$@" -} - -# If we are sourced from elsewhere, don't perform any further actions -if ! _is_sourced; then - _main "$@" -fi diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 6ce3baea8..8cb17c4b1 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -120,30 +120,9 @@ mysql_socket_fix() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.7' ]; then - "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & - mysql_note "Waiting for server startup" - local i - for i in {30..0}; do - # only use the root password if the database has already been initialized - # so that it won't try to fill in a password file when it hasn't been set yet - extraArgs=() - if [ -z "$DATABASE_ALREADY_EXISTS" ]; then - extraArgs+=( '--dont-use-mysql-root-password' ) - fi - if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then - break - fi - sleep 1 - done - if [ "$i" = 0 ]; then - mysql_error "Unable to start server." - fi - else - # For 5.7+ the server is ready for use as soon as startup command unblocks - if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then - mysql_error "Unable to start server." - fi + # For 5.7+ the server is ready for use as soon as startup command unblocks + if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then + mysql_error "Unable to start server." fi } diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index a1db8f738..01cf2acd7 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -2,13 +2,11 @@ set -Eeuo pipefail declare -A aliases=( - [5.7]='5' [innovation]='latest' ) defaultDefaultVariant='oracle' declare -A defaultVariants=( - #[5.7]='debian' #[8.0]='debian' ) diff --git a/innovation/docker-entrypoint.sh b/innovation/docker-entrypoint.sh index 6ce3baea8..8cb17c4b1 100755 --- a/innovation/docker-entrypoint.sh +++ b/innovation/docker-entrypoint.sh @@ -120,30 +120,9 @@ mysql_socket_fix() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.7' ]; then - "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & - mysql_note "Waiting for server startup" - local i - for i in {30..0}; do - # only use the root password if the database has already been initialized - # so that it won't try to fill in a password file when it hasn't been set yet - extraArgs=() - if [ -z "$DATABASE_ALREADY_EXISTS" ]; then - extraArgs+=( '--dont-use-mysql-root-password' ) - fi - if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then - break - fi - sleep 1 - done - if [ "$i" = 0 ]; then - mysql_error "Unable to start server." - fi - else - # For 5.7+ the server is ready for use as soon as startup command unblocks - if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then - mysql_error "Unable to start server." - fi + # For 5.7+ the server is ready for use as soon as startup command unblocks + if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then + mysql_error "Unable to start server." fi } diff --git a/template/Dockerfile.debian b/template/Dockerfile.debian index b760a2e9e..7089a3da9 100644 --- a/template/Dockerfile.debian +++ b/template/Dockerfile.debian @@ -74,18 +74,8 @@ RUN { \ } | debconf-set-selections \ && apt-get update \ && apt-get install -y \ -{{ if env.version == "5.7" then ( -}} - mysql-server="${MYSQL_VERSION}" \ -# comment out a few problematic configuration values - && find /etc/mysql/ -name '*.cnf' -print0 \ - | xargs -0 grep -lZE '^(bind-address|log)' \ - | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \ -# don't reverse lookup hostnames, they are usually another container - && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf \ -{{ ) else ( -}} mysql-community-client="${MYSQL_VERSION}" \ mysql-community-server-core="${MYSQL_VERSION}" \ -{{ ) end -}} && rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ @@ -94,12 +84,10 @@ RUN { \ VOLUME /var/lib/mysql -{{ if env.version != "5.7" then ( -}} # Config files COPY config/ /etc/mysql/ -{{ ) else "" end -}} COPY docker-entrypoint.sh /usr/local/bin/ -{{ if [ "5.7", "8.0" ] | index(env.version) then ( -}} +{{ if [ "8.0" ] | index(env.version) then ( -}} RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat {{ ) else "" end -}} ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/template/Dockerfile.oracle b/template/Dockerfile.oracle index c4e2c74de..1cdb354de 100644 --- a/template/Dockerfile.oracle +++ b/template/Dockerfile.oracle @@ -96,17 +96,6 @@ RUN set -eux; \ ! grep -F '!includedir' /etc/my.cnf; \ { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ mkdir -p /etc/mysql/conf.d; \ -{{ if env.version == "5.7" then ( -}} -# 5.7 Debian-based images also included "/etc/mysql/mysql.conf.d" so let's include it too - { echo '!includedir /etc/mysql/mysql.conf.d/'; } >> /etc/my.cnf; \ - mkdir -p /etc/mysql/mysql.conf.d; \ - \ -# comment out a few problematic configuration values - find /etc/my.cnf /etc/mysql/ -name '*.cnf' -print0 \ - | xargs -0 grep -lZE '^(bind-address|log)' \ - | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; \ - \ -{{ ) else "" end -}} # ensure these directories exist and have useful permissions # the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install mkdir -p /var/lib/mysql /var/run/mysqld; \ @@ -140,7 +129,7 @@ RUN set -eux; \ VOLUME /var/lib/mysql COPY docker-entrypoint.sh /usr/local/bin/ -{{ if [ "5.7", "8.0" ] | index(env.version) then ( -}} +{{ if [ "8.0" ] | index(env.version) then ( -}} RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat {{ ) else "" end -}} ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index 6ce3baea8..8cb17c4b1 100755 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -120,30 +120,9 @@ mysql_socket_fix() { # Do a temporary startup of the MySQL server, for init purposes docker_temp_server_start() { - if [ "${MYSQL_MAJOR}" = '5.7' ]; then - "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" & - mysql_note "Waiting for server startup" - local i - for i in {30..0}; do - # only use the root password if the database has already been initialized - # so that it won't try to fill in a password file when it hasn't been set yet - extraArgs=() - if [ -z "$DATABASE_ALREADY_EXISTS" ]; then - extraArgs+=( '--dont-use-mysql-root-password' ) - fi - if docker_process_sql "${extraArgs[@]}" --database=mysql <<<'SELECT 1' &> /dev/null; then - break - fi - sleep 1 - done - if [ "$i" = 0 ]; then - mysql_error "Unable to start server." - fi - else - # For 5.7+ the server is ready for use as soon as startup command unblocks - if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then - mysql_error "Unable to start server." - fi + # For 5.7+ the server is ready for use as soon as startup command unblocks + if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then + mysql_error "Unable to start server." fi } diff --git a/versions.json b/versions.json index f4fba08cc..50b7f7810 100644 --- a/versions.json +++ b/versions.json @@ -1,19 +1,4 @@ { - "5.7": { - "mysql-shell": { - "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/7", - "version": "8.0.35-1.el7" - }, - "oracle": { - "architectures": [ - "amd64" - ], - "repo": "https://repo.mysql.com/yum/mysql-5.7-community/docker/el/7", - "variant": "7-slim", - "version": "5.7.44-1.el7" - }, - "version": "5.7.44" - }, "8.0": { "debian": { "architectures": [ diff --git a/versions.sh b/versions.sh index 6fd12dfa9..92a61fd08 100755 --- a/versions.sh +++ b/versions.sh @@ -3,12 +3,12 @@ set -Eeuo pipefail defaultDebianSuite='bullseye' declare -A debianSuites=( - [5.7]='buster' + #[5.7]='buster' ) defaultOracleVariant='8-slim' declare -A oracleVariants=( - [5.7]='7-slim' + #[5.7]='7-slim' ) # https://repo.mysql.com/yum/mysql-8.0-community/docker/ From d65c7ea65f7d156a6d1231c28c64e88770f08075 Mon Sep 17 00:00:00 2001 From: Joseph Ferguson Date: Mon, 18 Dec 2023 16:17:52 -0800 Subject: [PATCH 220/285] Fix gitattributes file Move templates to be consistent with other repos --- .gitattributes | 6 +++--- template/Dockerfile.debian => Dockerfile.debian | 0 template/Dockerfile.oracle => Dockerfile.oracle | 0 apply-templates.sh | 4 ++-- template/docker-entrypoint.sh => docker-entrypoint.sh | 0 versions.sh | 1 - 6 files changed, 5 insertions(+), 6 deletions(-) rename template/Dockerfile.debian => Dockerfile.debian (100%) rename template/Dockerfile.oracle => Dockerfile.oracle (100%) rename template/docker-entrypoint.sh => docker-entrypoint.sh (100%) diff --git a/.gitattributes b/.gitattributes index dfa02cc85..6edb60681 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,3 @@ -/*.*/**/Dockerfile* linguist-generated -/*.*/**/docker-entrypoint.sh linguist-generated -Dockerfile* linguist-language=Dockerfile +/*/**/Dockerfile* linguist-generated +/*/**/docker-entrypoint.sh linguist-generated +Dockerfile* linguist-language=Dockerfile diff --git a/template/Dockerfile.debian b/Dockerfile.debian similarity index 100% rename from template/Dockerfile.debian rename to Dockerfile.debian diff --git a/template/Dockerfile.oracle b/Dockerfile.oracle similarity index 100% rename from template/Dockerfile.oracle rename to Dockerfile.oracle diff --git a/apply-templates.sh b/apply-templates.sh index 3c84529ab..9c6c2bf60 100755 --- a/apply-templates.sh +++ b/apply-templates.sh @@ -46,10 +46,10 @@ for version; do dockerfile="Dockerfile.$variant" { generated_warning - gawk -f "$jqt" "template/$dockerfile" + gawk -f "$jqt" "$dockerfile" } > "$version/$dockerfile" fi done - cp -a template/docker-entrypoint.sh "$version/docker-entrypoint.sh" + cp -a docker-entrypoint.sh "$version/docker-entrypoint.sh" done diff --git a/template/docker-entrypoint.sh b/docker-entrypoint.sh similarity index 100% rename from template/docker-entrypoint.sh rename to docker-entrypoint.sh diff --git a/versions.sh b/versions.sh index 92a61fd08..f8a208849 100755 --- a/versions.sh +++ b/versions.sh @@ -62,7 +62,6 @@ fi versions=( "${versions[@]%/}" ) for version in "${versions[@]}"; do - [ "$version" != 'template' ] || continue export version doc='{}' From ffa6423ca24168e4d96631b5e8f536ac826d2a5b Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 18 Jan 2024 09:35:29 -0800 Subject: [PATCH 221/285] Update to 8.0.36 and 8.3.0 (and update RPM repo PGP key) --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 11 +++++++---- Dockerfile.oracle | 7 +++++-- innovation/Dockerfile.oracle | 11 +++++++---- versions.json | 14 +++++++------- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index c231d2d62..ad0cd3a58 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.35-1debian11 +ENV MYSQL_VERSION 8.0.36-1debian11 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bullseye mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 0bc9653e3..585210e17 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -45,15 +45,18 @@ RUN set -eux; \ RUN set -eux; \ # https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html -# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported - key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ +# pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] +# BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C +# uid [ unknown] MySQL Release Engineering +# sub rsa4096 2023-10-23 [E] [expires: 2025-10-22] + key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.35-1.el8 +ENV MYSQL_VERSION 8.0.36-1.el8 RUN set -eu; \ { \ @@ -104,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.35-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.36-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/Dockerfile.oracle b/Dockerfile.oracle index 1cdb354de..12a7176dc 100644 --- a/Dockerfile.oracle +++ b/Dockerfile.oracle @@ -60,8 +60,11 @@ RUN set -eux; \ RUN set -eux; \ # https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html -# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported - key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ +# pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] +# BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C +# uid [ unknown] MySQL Release Engineering +# sub rsa4096 2023-10-23 [E] [expires: 2025-10-22] + key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 334a3d00a..073de1162 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -45,15 +45,18 @@ RUN set -eux; \ RUN set -eux; \ # https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html -# gpg: key 3A79BD29: public key "MySQL Release Engineering " imported - key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \ +# pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] +# BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C +# uid [ unknown] MySQL Release Engineering +# sub rsa4096 2023-10-23 [E] [expires: 2025-10-22] + key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 8.2.0-1.el8 +ENV MYSQL_VERSION 8.3.0-1.el8 RUN set -eu; \ { \ @@ -104,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.2.1-1.el8 +ENV MYSQL_SHELL_VERSION 8.3.0-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 50b7f7810..3532fb3d5 100644 --- a/versions.json +++ b/versions.json @@ -5,11 +5,11 @@ "amd64" ], "suite": "bullseye", - "version": "8.0.35-1debian11" + "version": "8.0.36-1debian11" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8", - "version": "8.0.35-1.el8" + "version": "8.0.36-1.el8" }, "oracle": { "architectures": [ @@ -18,14 +18,14 @@ ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8", "variant": "8-slim", - "version": "8.0.35-1.el8" + "version": "8.0.36-1.el8" }, - "version": "8.0.35" + "version": "8.0.36" }, "innovation": { "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8", - "version": "8.2.1-1.el8" + "version": "8.3.0-1.el8" }, "oracle": { "architectures": [ @@ -34,8 +34,8 @@ ], "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8", "variant": "8-slim", - "version": "8.2.0-1.el8" + "version": "8.3.0-1.el8" }, - "version": "8.2.0" + "version": "8.3.0" } } From b6029999be3702e6b67f35e6a5a5c3532d272058 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 18 Jan 2024 09:38:06 -0800 Subject: [PATCH 222/285] Update GHA YAML with bashbrew example improvements (esp. concurrency:) --- .github/workflows/ci.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3860c115c..61ffb56ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ name: GitHub CI on: pull_request: push: + workflow_dispatch: schedule: - cron: 0 0 * * 0 @@ -10,6 +11,13 @@ defaults: run: shell: 'bash -Eeuo pipefail -x {0}' +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + jobs: generate-jobs: @@ -24,8 +32,11 @@ jobs: name: Generate Jobs run: | strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")" - echo "strategy=$strategy" >> "$GITHUB_OUTPUT" - jq . <<<"$strategy" # sanity check / debugging aid + + EOF="EOF-$RANDOM-$RANDOM-$RANDOM" + echo "strategy<<$EOF" >> "$GITHUB_OUTPUT" + jq <<<"$strategy" . | tee -a "$GITHUB_OUTPUT" + echo "$EOF" >> "$GITHUB_OUTPUT" test: needs: generate-jobs From d6c12b61316e44e52ce195dd6343ac96e8343fce Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 28 Feb 2024 13:25:11 -0800 Subject: [PATCH 223/285] Update to Debian Bookworm --- 8.0/Dockerfile.debian | 6 +++--- versions.json | 4 ++-- versions.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index ad0cd3a58..aab9ea589 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:bullseye-slim +FROM debian:bookworm-slim # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN groupadd -r mysql && useradd -r -g mysql mysql @@ -66,9 +66,9 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.36-1debian11 +ENV MYSQL_VERSION 8.0.36-1debian12 -RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bullseye mysql-8.0' > /etc/apt/sources.list.d/mysql.list +RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list # the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) # also, we set debconf keys to make APT a little quieter diff --git a/versions.json b/versions.json index 3532fb3d5..a33359b41 100644 --- a/versions.json +++ b/versions.json @@ -4,8 +4,8 @@ "architectures": [ "amd64" ], - "suite": "bullseye", - "version": "8.0.36-1debian11" + "suite": "bookworm", + "version": "8.0.36-1debian12" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8", diff --git a/versions.sh b/versions.sh index f8a208849..e285d65c0 100755 --- a/versions.sh +++ b/versions.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -Eeuo pipefail -defaultDebianSuite='bullseye' +defaultDebianSuite='bookworm' declare -A debianSuites=( #[5.7]='buster' ) From 831e58702aa316b69cdfaa115fc134bfede4c418 Mon Sep 17 00:00:00 2001 From: zhangguanzhang Date: Tue, 26 Mar 2024 11:08:38 +0800 Subject: [PATCH 224/285] Update to gosu 1.17 Signed-off-by: zhangguanzhang --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 2 +- Dockerfile.debian | 2 +- Dockerfile.oracle | 2 +- innovation/Dockerfile.oracle | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index aab9ea589..012452c35 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.16 +ENV GOSU_VERSION 1.17 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 585210e17..ded883dc8 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -12,7 +12,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.16 +ENV GOSU_VERSION 1.17 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/Dockerfile.debian b/Dockerfile.debian index 7089a3da9..5df28c5bb 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.16 +ENV GOSU_VERSION 1.17 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/Dockerfile.oracle b/Dockerfile.oracle index 12a7176dc..15fcabcad 100644 --- a/Dockerfile.oracle +++ b/Dockerfile.oracle @@ -21,7 +21,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.16 +ENV GOSU_VERSION 1.17 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 073de1162..ec92df68e 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -12,7 +12,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.16 +ENV GOSU_VERSION 1.17 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ From 5fe2b708e9734809d7f6554c131f0371d517bb22 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 29 Apr 2024 21:15:13 -0700 Subject: [PATCH 225/285] Update 8.0 to 8.0.37, debian 8.0.37-1debian12, mysql-shell 8.0.37-1.el8, oracle 8.0.37-1.el8 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 012452c35..db6808d00 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.36-1debian12 +ENV MYSQL_VERSION 8.0.37-1debian12 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index ded883dc8..052bad5ce 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.36-1.el8 +ENV MYSQL_VERSION 8.0.37-1.el8 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.36-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.37-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index a33359b41..9577beeb4 100644 --- a/versions.json +++ b/versions.json @@ -5,11 +5,11 @@ "amd64" ], "suite": "bookworm", - "version": "8.0.36-1debian12" + "version": "8.0.37-1debian12" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8", - "version": "8.0.36-1.el8" + "version": "8.0.37-1.el8" }, "oracle": { "architectures": [ @@ -18,9 +18,9 @@ ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8", "variant": "8-slim", - "version": "8.0.36-1.el8" + "version": "8.0.37-1.el8" }, - "version": "8.0.36" + "version": "8.0.37" }, "innovation": { "mysql-shell": { From 2319f1794da4a7f5882aef2690cdc6ffaa926f6a Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 29 Apr 2024 21:23:09 -0700 Subject: [PATCH 226/285] Update innovation to mysql-shell 8.4.0-1.el8 --- innovation/Dockerfile.oracle | 2 +- versions.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index ec92df68e..15f17293d 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.3.0-1.el8 +ENV MYSQL_SHELL_VERSION 8.4.0-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 9577beeb4..5568be78a 100644 --- a/versions.json +++ b/versions.json @@ -25,7 +25,7 @@ "innovation": { "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8", - "version": "8.3.0-1.el8" + "version": "8.4.0-1.el8" }, "oracle": { "architectures": [ From e3c28539272817973ee045d6423fa6ebf534ac06 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Tue, 30 Apr 2024 14:40:02 +0200 Subject: [PATCH 227/285] Update toolsRepo detection in versions.sh --- versions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions.sh b/versions.sh index e285d65c0..10aaa1ae2 100755 --- a/versions.sh +++ b/versions.sh @@ -105,8 +105,8 @@ for version in "${versions[@]}"; do rpmRepo="https://repo.mysql.com/yum/mysql-$version-community/docker/el/$oracleVersion" case "$version" in - innovation) toolsRepo="https://repo.mysql.com/yum/mysql-tools-innovation-community/el/$oracleVersion" ;; - *) toolsRepo="https://repo.mysql.com/yum/mysql-tools-community/el/$oracleVersion" ;; + 8.0) toolsRepo="https://repo.mysql.com/yum/mysql-tools-community/el/$oracleVersion" ;; + *) toolsRepo="https://repo.mysql.com/yum/mysql-tools-$version-community/el/$oracleVersion" ;; esac export rpmRepo toolsRepo From c05422492215b3f0602409288c868ee4fd606ac3 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Tue, 30 Apr 2024 14:34:10 +0200 Subject: [PATCH 228/285] Add 8.4 variant (new LTS) --- 8.4/Dockerfile.oracle | 123 ++++++++++++ 8.4/docker-entrypoint.sh | 416 +++++++++++++++++++++++++++++++++++++++ versions.json | 16 ++ 3 files changed, 555 insertions(+) create mode 100644 8.4/Dockerfile.oracle create mode 100755 8.4/docker-entrypoint.sh diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle new file mode 100644 index 000000000..c4ff96106 --- /dev/null +++ b/8.4/Dockerfile.oracle @@ -0,0 +1,123 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM oraclelinux:8-slim + +RUN set -eux; \ + groupadd --system --gid 999 mysql; \ + useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql + +# add gosu for easy step-down from root +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.17 +RUN set -eux; \ +# TODO find a better userspace architecture detection method than querying the kernel + arch="$(uname -m)"; \ + case "$arch" in \ + aarch64) gosuArch='arm64' ;; \ + x86_64) gosuArch='amd64' ;; \ + *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ + esac; \ + curl -fL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch.asc"; \ + curl -fL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true + +RUN set -eux; \ + microdnf install -y \ + bzip2 \ + gzip \ + openssl \ + xz \ + zstd \ +# Oracle Linux 8+ is very slim :) + findutils \ + ; \ + microdnf clean all + +RUN set -eux; \ +# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html +# pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] +# BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C +# uid [ unknown] MySQL Release Engineering +# sub rsa4096 2023-10-23 [E] [expires: 2025-10-22] + key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ + rm -rf "$GNUPGHOME" + +ENV MYSQL_MAJOR 8.4 +ENV MYSQL_VERSION 8.4.0-1.el8 + +RUN set -eu; \ + { \ + echo '[mysql8.4-server-minimal]'; \ + echo 'name=MySQL 8.4 Server Minimal'; \ + echo 'enabled=1'; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-8.4-community/docker/el/8/$basearch/'; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-minimal.repo + +RUN set -eux; \ + microdnf install -y "mysql-community-server-minimal-$MYSQL_VERSION"; \ + microdnf clean all; \ +# the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead) +# https://github.com/docker-library/mysql/pull/680#issuecomment-636121520 + grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ + sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ + grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ + { echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf; \ + \ +# make sure users dumping files in "/etc/mysql/conf.d" still works + ! grep -F '!includedir' /etc/my.cnf; \ + { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ + mkdir -p /etc/mysql/conf.d; \ +# ensure these directories exist and have useful permissions +# the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install + mkdir -p /var/lib/mysql /var/run/mysqld; \ + chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + chmod 1777 /var/lib/mysql /var/run/mysqld; \ + \ + mkdir /docker-entrypoint-initdb.d; \ + \ + mysqld --version; \ + mysql --version + +RUN set -eu; \ + { \ + echo '[mysql-tools-community]'; \ + echo 'name=MySQL Tools Community'; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-8.4-community/el/8/$basearch/'; \ + echo 'enabled=1'; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-tools.repo +ENV MYSQL_SHELL_VERSION 8.4.0-1.el8 +RUN set -eux; \ + microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ + microdnf clean all; \ + \ + mysqlsh --version + +VOLUME /var/lib/mysql + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 3306 33060 +CMD ["mysqld"] diff --git a/8.4/docker-entrypoint.sh b/8.4/docker-entrypoint.sh new file mode 100755 index 000000000..8cb17c4b1 --- /dev/null +++ b/8.4/docker-entrypoint.sh @@ -0,0 +1,416 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +# logging functions +mysql_log() { + local type="$1"; shift + # accept argument string or stdin + local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi + local dt; dt="$(date --rfc-3339=seconds)" + printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text" +} +mysql_note() { + mysql_log Note "$@" +} +mysql_warn() { + mysql_log Warn "$@" >&2 +} +mysql_error() { + mysql_log ERROR "$@" >&2 + exit 1 +} + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + mysql_error "Both $var and $fileVar are set (but are exclusive)" + fi + local val="$def" + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + export "$var"="$val" + unset "$fileVar" +} + +# check to see if this file is being run or sourced from another script +_is_sourced() { + # https://unix.stackexchange.com/a/215279 + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] +} + +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions +docker_process_init_files() { + # mysql here for backwards compatibility "${mysql[@]}" + mysql=( docker_process_sql ) + + echo + local f + for f; do + case "$f" in + *.sh) + # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 + # https://github.com/docker-library/postgres/pull/452 + if [ -x "$f" ]; then + mysql_note "$0: running $f" + "$f" + else + mysql_note "$0: sourcing $f" + . "$f" + fi + ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.bz2) mysql_note "$0: running $f"; bunzip2 -c "$f" | docker_process_sql; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; + *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; + *) mysql_warn "$0: ignoring $f" ;; + esac + echo + done +} + +# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) +_verboseHelpArgs=( + --verbose --help + --log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136 +) + +mysql_check_config() { + local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors + if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then + mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" + fi +} + +# Fetch value from server config +# We use mysqld --verbose --help instead of my_print_defaults because the +# latter only show values present in config files, and not server defaults +mysql_get_config() { + local conf="$1"; shift + "$@" "${_verboseHelpArgs[@]}" 2>/dev/null \ + | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" +} + +# Ensure that the package default socket can also be used +# since rpm packages are compiled with a different socket location +# and "mysqlsh --mysql" doesn't read the [client] config +# related to https://github.com/docker-library/mysql/issues/829 +mysql_socket_fix() { + local defaultSocket + defaultSocket="$(mysql_get_config 'socket' mysqld --no-defaults)" + if [ "$defaultSocket" != "$SOCKET" ]; then + ln -sfTv "$SOCKET" "$defaultSocket" || : + fi +} + +# Do a temporary startup of the MySQL server, for init purposes +docker_temp_server_start() { + # For 5.7+ the server is ready for use as soon as startup command unblocks + if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then + mysql_error "Unable to start server." + fi +} + +# Stop the server. When using a local socket file mysqladmin will block until +# the shutdown is complete. +docker_temp_server_stop() { + if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then + mysql_error "Unable to shut down server." + fi +} + +# Verify that the minimally required password settings are set for new databases. +docker_verify_minimum_env() { + if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + mysql_error <<-'EOF' + Database is uninitialized and password option is not specified + You need to specify one of the following as an environment variable: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) + if [ "$MYSQL_USER" = 'root' ]; then + mysql_error <<-'EOF' + MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user + Remove MYSQL_USER="root" and use one of the following to control the root user password: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # warn when missing one of MYSQL_USER or MYSQL_PASSWORD + if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created' + elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored' + fi +} + +# creates folders for the database +# also ensures permission for user mysql of run as root +docker_create_db_directories() { + local user; user="$(id -u)" + + local -A dirs=( ["$DATADIR"]=1 ) + local dir + dir="$(dirname "$SOCKET")" + dirs["$dir"]=1 + + # "datadir" and "socket" are already handled above (since they were already queried previously) + local conf + for conf in \ + general-log-file \ + keyring_file_data \ + pid-file \ + secure-file-priv \ + slow-query-log-file \ + ; do + dir="$(mysql_get_config "$conf" "$@")" + + # skip empty values + if [ -z "$dir" ] || [ "$dir" = 'NULL' ]; then + continue + fi + case "$conf" in + secure-file-priv) + # already points at a directory + ;; + *) + # other config options point at a file, but we need the directory + dir="$(dirname "$dir")" + ;; + esac + + dirs["$dir"]=1 + done + + mkdir -p "${!dirs[@]}" + + if [ "$user" = "0" ]; then + # this will cause less disk access than `chown -R` + find "${!dirs[@]}" \! -user mysql -exec chown --no-dereference mysql '{}' + + fi +} + +# initializes the database directory +docker_init_database_dir() { + mysql_note "Initializing database files" + "$@" --initialize-insecure --default-time-zone=SYSTEM + mysql_note "Database files initialized" +} + +# Loads various settings that are used elsewhere in the script +# This should be called after mysql_check_config, but before any other functions +docker_setup_env() { + # Get config + declare -g DATADIR SOCKET + DATADIR="$(mysql_get_config 'datadir' "$@")" + SOCKET="$(mysql_get_config 'socket' "$@")" + + # Initialize values that might be stored in a file + file_env 'MYSQL_ROOT_HOST' '%' + file_env 'MYSQL_DATABASE' + file_env 'MYSQL_USER' + file_env 'MYSQL_PASSWORD' + file_env 'MYSQL_ROOT_PASSWORD' + + declare -g DATABASE_ALREADY_EXISTS + if [ -d "$DATADIR/mysql" ]; then + DATABASE_ALREADY_EXISTS='true' + fi +} + +# Execute sql script, passed via stdin +# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args] +# ie: docker_process_sql --database=mydb <<<'INSERT ...' +# ie: docker_process_sql --dont-use-mysql-root-password --database=mydb /dev/null + + docker_init_database_dir "$@" + + mysql_note "Starting temporary server" + docker_temp_server_start "$@" + mysql_note "Temporary server started." + + mysql_socket_fix + docker_setup_db + docker_process_init_files /docker-entrypoint-initdb.d/* + + mysql_expire_root_user + + mysql_note "Stopping temporary server" + docker_temp_server_stop + mysql_note "Temporary server stopped" + + echo + mysql_note "MySQL init process done. Ready for start up." + echo + else + mysql_socket_fix + fi + fi + exec "$@" +} + +# If we are sourced from elsewhere, don't perform any further actions +if ! _is_sourced; then + _main "$@" +fi diff --git a/versions.json b/versions.json index 5568be78a..a5a5e0d9f 100644 --- a/versions.json +++ b/versions.json @@ -22,6 +22,22 @@ }, "version": "8.0.37" }, + "8.4": { + "mysql-shell": { + "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/8", + "version": "8.4.0-1.el8" + }, + "oracle": { + "architectures": [ + "amd64", + "arm64v8" + ], + "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/8", + "variant": "8-slim", + "version": "8.4.0-1.el8" + }, + "version": "8.4.0" + }, "innovation": { "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8", From 53973fa0a9a10829b923d7a0aba37a73ea8cbb30 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Tue, 30 Apr 2024 14:34:28 +0200 Subject: [PATCH 229/285] Add lts alias --- generate-stackbrew-library.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 01cf2acd7..c370158ef 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -2,6 +2,7 @@ set -Eeuo pipefail declare -A aliases=( + [8.4]='lts' [innovation]='latest' ) From 784047f747a444121e90db5903b27d70ff1b398a Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 30 Apr 2024 14:39:23 -0700 Subject: [PATCH 230/285] Skip "innovation" when any other release is newer We're in a temporary state where we have 8.4 as the freshly minted LTS and innovation still points to 8.3 (which is now "EOL") until 9.x -- this implementation ensures we bring innovation back automatically when it gets 9.x. See also https://dev.mysql.com/blog-archive/introducing-mysql-innovation-and-long-term-support-lts-versions/ especially the final graphic. --- generate-stackbrew-library.sh | 20 +++++++++++-- versions.json | 56 +++++++++++++++++------------------ versions.sh | 14 ++++++++- 3 files changed, 58 insertions(+), 32 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index c370158ef..9119eb29e 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -3,7 +3,6 @@ set -Eeuo pipefail declare -A aliases=( [8.4]='lts' - [innovation]='latest' ) defaultDefaultVariant='oracle' @@ -14,6 +13,10 @@ declare -A defaultVariants=( self="$(basename "$BASH_SOURCE")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" +# add the "latest" alias to the "newest" version (LTS vs innovation; see sorting in "versions.sh") +latest="$(jq -r 'keys_unsorted[0]' versions.json)" +aliases["$latest"]+=' latest' + if [ "$#" -eq 0 ]; then versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" eval "set -- $versions" @@ -64,8 +67,18 @@ join() { for version; do export version - defaultVariant="${defaultVariants[$version]:-$defaultDefaultVariant}" - fullVersion="$(jq -r '.[env.version].version' versions.json)" + if ! fullVersion="$(jq -re ' + if env.version == "innovation" and keys_unsorted[0] != env.version then + # https://github.com/docker-library/mysql/pull/1046#issuecomment-2087323746 + # if any explicit/LTS release is *newer* than the current innovation release, we should skip innovation + # (because we pre-sorted the full list in "versions.sh", we just need to check whether "innovation" is first 🚀) + false + else + .[env.version].version + end + ' versions.json)"; then + continue + fi versionAliases=() while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do @@ -78,6 +91,7 @@ for version; do fi versionAliases+=( ${aliases[$version]:-} ) + defaultVariant="${defaultVariants[$version]:-$defaultDefaultVariant}" for variant in oracle debian; do export variant diff --git a/versions.json b/versions.json index a5a5e0d9f..a1ad17ea0 100644 --- a/versions.json +++ b/versions.json @@ -1,57 +1,57 @@ { - "8.0": { - "debian": { - "architectures": [ - "amd64" - ], - "suite": "bookworm", - "version": "8.0.37-1debian12" - }, - "mysql-shell": { - "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8", - "version": "8.0.37-1.el8" - }, + "8.4": { "oracle": { "architectures": [ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8", - "variant": "8-slim", - "version": "8.0.37-1.el8" + "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/8", + "version": "8.4.0-1.el8", + "variant": "8-slim" }, - "version": "8.0.37" - }, - "8.4": { "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/8", "version": "8.4.0-1.el8" }, + "version": "8.4.0" + }, + "innovation": { "oracle": { "architectures": [ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/8", - "variant": "8-slim", - "version": "8.4.0-1.el8" + "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8", + "version": "8.3.0-1.el8", + "variant": "8-slim" }, - "version": "8.4.0" - }, - "innovation": { "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8", "version": "8.4.0-1.el8" }, + "version": "8.3.0" + }, + "8.0": { + "version": "8.0.37", + "debian": { + "architectures": [ + "amd64" + ], + "suite": "bookworm", + "version": "8.0.37-1debian12" + }, "oracle": { "architectures": [ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8", - "variant": "8-slim", - "version": "8.3.0-1.el8" + "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8", + "version": "8.0.37-1.el8", + "variant": "8-slim" }, - "version": "8.3.0" + "mysql-shell": { + "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8", + "version": "8.0.37-1.el8" + } } } diff --git a/versions.sh b/versions.sh index 10aaa1ae2..8c0f57ebd 100755 --- a/versions.sh +++ b/versions.sh @@ -172,4 +172,16 @@ for version in "${versions[@]}"; do json="$(jq <<<"$json" -c --argjson doc "$doc" '.[env.version] = $doc')" done -jq <<<"$json" -S . > versions.json +jq <<<"$json" ' + # sort entries in descending version order so that it is easier to determine later (in "generate-stackbrew-library.sh") if "innovation" should be included or not, and which entry to give the "latest" alias to (the first one!) + # https://github.com/docker-library/mysql/pull/1046#issuecomment-2087323746 + to_entries + | sort_by( + # very rough "sort by version number" + .value.version + | split(".") + | map(tonumber? // .) + ) + | reverse + | from_entries +' > versions.json From 9f0f4a14ab251e22545f8ccaa2fff0c3e5206d09 Mon Sep 17 00:00:00 2001 From: Joseph Ferguson Date: Tue, 30 Apr 2024 16:09:20 -0700 Subject: [PATCH 231/285] Add plain 8 aliases --- generate-stackbrew-library.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 9119eb29e..16e8b1c5f 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -2,7 +2,7 @@ set -Eeuo pipefail declare -A aliases=( - [8.4]='lts' + [8.4]='8 lts' ) defaultDefaultVariant='oracle' From a15b34a032f48089ee7b02d307d8f89a96b3bb76 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Wed, 1 May 2024 09:22:24 +0200 Subject: [PATCH 232/285] Use Oracle Linux 9 as base image --- 8.0/Dockerfile.oracle | 10 +++++----- 8.4/Dockerfile.oracle | 10 +++++----- versions.json | 20 ++++++++++---------- versions.sh | 4 ++-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 052bad5ce..d872b6680 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM oraclelinux:8-slim +FROM oraclelinux:9-slim RUN set -eux; \ groupadd --system --gid 999 mysql; \ @@ -56,14 +56,14 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.37-1.el8 +ENV MYSQL_VERSION 8.0.37-1.el9 RUN set -eu; \ { \ echo '[mysql8.0-server-minimal]'; \ echo 'name=MySQL 8.0 Server Minimal'; \ echo 'enabled=1'; \ - echo 'baseurl=https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8/$basearch/'; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9/$basearch/'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 @@ -100,14 +100,14 @@ RUN set -eu; \ { \ echo '[mysql-tools-community]'; \ echo 'name=MySQL Tools Community'; \ - echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/8/$basearch/'; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/9/$basearch/'; \ echo 'enabled=1'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.37-1.el8 +ENV MYSQL_SHELL_VERSION 8.0.37-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index c4ff96106..607f9c54a 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM oraclelinux:8-slim +FROM oraclelinux:9-slim RUN set -eux; \ groupadd --system --gid 999 mysql; \ @@ -56,14 +56,14 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.0-1.el8 +ENV MYSQL_VERSION 8.4.0-1.el9 RUN set -eu; \ { \ echo '[mysql8.4-server-minimal]'; \ echo 'name=MySQL 8.4 Server Minimal'; \ echo 'enabled=1'; \ - echo 'baseurl=https://repo.mysql.com/yum/mysql-8.4-community/docker/el/8/$basearch/'; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9/$basearch/'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 @@ -100,14 +100,14 @@ RUN set -eu; \ { \ echo '[mysql-tools-community]'; \ echo 'name=MySQL Tools Community'; \ - echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-8.4-community/el/8/$basearch/'; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9/$basearch/'; \ echo 'enabled=1'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.0-1.el8 +ENV MYSQL_SHELL_VERSION 8.4.0-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index a1ad17ea0..78f31dddf 100644 --- a/versions.json +++ b/versions.json @@ -5,13 +5,13 @@ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/8", - "version": "8.4.0-1.el8", - "variant": "8-slim" + "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", + "version": "8.4.0-1.el9", + "variant": "9-slim" }, "mysql-shell": { - "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/8", - "version": "8.4.0-1.el8" + "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", + "version": "8.4.0-1.el9" }, "version": "8.4.0" }, @@ -45,13 +45,13 @@ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/8", - "version": "8.0.37-1.el8", - "variant": "8-slim" + "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", + "version": "8.0.37-1.el9", + "variant": "9-slim" }, "mysql-shell": { - "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/8", - "version": "8.0.37-1.el8" + "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/9", + "version": "8.0.37-1.el9" } } } diff --git a/versions.sh b/versions.sh index 8c0f57ebd..cb73b25ef 100755 --- a/versions.sh +++ b/versions.sh @@ -6,9 +6,9 @@ declare -A debianSuites=( #[5.7]='buster' ) -defaultOracleVariant='8-slim' +defaultOracleVariant='9-slim' declare -A oracleVariants=( - #[5.7]='7-slim' + [innovation]='8-slim' ) # https://repo.mysql.com/yum/mysql-8.0-community/docker/ From 6faf41e2e9d9d0a2b97d83449830ca75cbee17f9 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 9 May 2024 14:03:01 -0700 Subject: [PATCH 233/285] Make sure that in the event of a tie between "release pockets", we prefer non-innovation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now, we're in the unique situation of "innovation" containing 8.4.0 just like "8.4" does, but we want to prefer the "lts" branch (and add the "innovation" alias to it 👀). --- generate-stackbrew-library.sh | 5 +++++ versions.sh | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 16e8b1c5f..485cbb5b0 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -16,6 +16,11 @@ cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" # add the "latest" alias to the "newest" version (LTS vs innovation; see sorting in "versions.sh") latest="$(jq -r 'keys_unsorted[0]' versions.json)" aliases["$latest"]+=' latest' +# if "innovation" currently is in line with an LTS, add the "innovation" alias to the LTS release +innovation="$(jq -r 'to_entries | if .[0].value.version == .[1].value.version and .[1].key == "innovation" then .[0].key else "innovation" end' versions.json)" +if [ "$innovation" != 'innovation' ]; then + aliases["$innovation"]+=' innovation' +fi if [ "$#" -eq 0 ]; then versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" diff --git a/versions.sh b/versions.sh index cb73b25ef..3b0823e97 100755 --- a/versions.sh +++ b/versions.sh @@ -177,10 +177,17 @@ jq <<<"$json" ' # https://github.com/docker-library/mysql/pull/1046#issuecomment-2087323746 to_entries | sort_by( - # very rough "sort by version number" - .value.version - | split(".") - | map(tonumber? // .) + [ + ( + # very rough "sort by version number" + .value.version + | split(".") + | map(tonumber? // .) + ), + # when two versions are equal (8.4.0 copied to "innovation" *and* in "8.4", for example), prefer the LTS/explicit release over "innovation" + .key != "innovation" + # (false sorts above true, but then we reverse) + ] ) | reverse | from_entries From c857c9c091e6194c9fb9c91e83d343b186e103cd Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Thu, 9 May 2024 14:47:13 -0700 Subject: [PATCH 234/285] Update innovation to 8.4.0, oracle 8.4.0-1.el8, mysql-shell 8.4.0-1.el8 --- innovation/Dockerfile.oracle | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 15f17293d..847fb0ff4 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 8.3.0-1.el8 +ENV MYSQL_VERSION 8.4.0-1.el8 RUN set -eu; \ { \ diff --git a/versions.json b/versions.json index 78f31dddf..5565bfe69 100644 --- a/versions.json +++ b/versions.json @@ -22,14 +22,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8", - "version": "8.3.0-1.el8", + "version": "8.4.0-1.el8", "variant": "8-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8", "version": "8.4.0-1.el8" }, - "version": "8.3.0" + "version": "8.4.0" }, "8.0": { "version": "8.0.37", From 319db566ac7fef45c22f3df15ee5e194a7c43259 Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Thu, 30 May 2024 16:18:01 -0400 Subject: [PATCH 235/285] Support running server with autocommit Forces initiation queries to run in autocommit then use the provided mode Fixed #816 --- 8.0/docker-entrypoint.sh | 6 +++++- 8.4/docker-entrypoint.sh | 6 +++++- docker-entrypoint.sh | 6 +++++- innovation/docker-entrypoint.sh | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index 8cb17c4b1..e635e0762 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -214,7 +214,8 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - "$@" --initialize-insecure --default-time-zone=SYSTEM + "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1 + # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a) mysql_note "Database files initialized" } @@ -292,6 +293,9 @@ docker_setup_db() { # tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is just now being set docker_process_sql --dont-use-mysql-root-password --database=mysql <<-EOSQL + -- enable autocommit explicitly (in case it was disabled globally) + SET autocommit = 1; + -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; diff --git a/8.4/docker-entrypoint.sh b/8.4/docker-entrypoint.sh index 8cb17c4b1..e635e0762 100755 --- a/8.4/docker-entrypoint.sh +++ b/8.4/docker-entrypoint.sh @@ -214,7 +214,8 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - "$@" --initialize-insecure --default-time-zone=SYSTEM + "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1 + # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a) mysql_note "Database files initialized" } @@ -292,6 +293,9 @@ docker_setup_db() { # tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is just now being set docker_process_sql --dont-use-mysql-root-password --database=mysql <<-EOSQL + -- enable autocommit explicitly (in case it was disabled globally) + SET autocommit = 1; + -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8cb17c4b1..e635e0762 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -214,7 +214,8 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - "$@" --initialize-insecure --default-time-zone=SYSTEM + "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1 + # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a) mysql_note "Database files initialized" } @@ -292,6 +293,9 @@ docker_setup_db() { # tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is just now being set docker_process_sql --dont-use-mysql-root-password --database=mysql <<-EOSQL + -- enable autocommit explicitly (in case it was disabled globally) + SET autocommit = 1; + -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; diff --git a/innovation/docker-entrypoint.sh b/innovation/docker-entrypoint.sh index 8cb17c4b1..e635e0762 100755 --- a/innovation/docker-entrypoint.sh +++ b/innovation/docker-entrypoint.sh @@ -214,7 +214,8 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - "$@" --initialize-insecure --default-time-zone=SYSTEM + "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1 + # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a) mysql_note "Database files initialized" } @@ -292,6 +293,9 @@ docker_setup_db() { # tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is just now being set docker_process_sql --dont-use-mysql-root-password --database=mysql <<-EOSQL + -- enable autocommit explicitly (in case it was disabled globally) + SET autocommit = 1; + -- What's done in this file shouldn't be replicated -- or products like mysql-fabric won't work SET @@SESSION.SQL_LOG_BIN=0; From db7daba00da79773c594b94bd91c9deeca1c9c88 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 1 Jul 2024 21:16:15 -0700 Subject: [PATCH 236/285] Update 8.0 to 8.0.38, debian 8.0.38-1debian12, oracle 8.0.38-1.el9, mysql-shell 8.0.38-1.el9 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index db6808d00..5e08f3f29 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.37-1debian12 +ENV MYSQL_VERSION 8.0.38-1debian12 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index d872b6680..d18d98f26 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.37-1.el9 +ENV MYSQL_VERSION 8.0.38-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.37-1.el9 +ENV MYSQL_SHELL_VERSION 8.0.38-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 5565bfe69..b2ffb8c45 100644 --- a/versions.json +++ b/versions.json @@ -32,13 +32,13 @@ "version": "8.4.0" }, "8.0": { - "version": "8.0.37", + "version": "8.0.38", "debian": { "architectures": [ "amd64" ], "suite": "bookworm", - "version": "8.0.37-1debian12" + "version": "8.0.38-1debian12" }, "oracle": { "architectures": [ @@ -46,12 +46,12 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", - "version": "8.0.37-1.el9", + "version": "8.0.38-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/9", - "version": "8.0.37-1.el9" + "version": "8.0.38-1.el9" } } } From efa7479ffbb00139f6f1f0b0fe70985f20ee0456 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 1 Jul 2024 21:20:59 -0700 Subject: [PATCH 237/285] Update 8.4 to 8.4.1, oracle 8.4.1-1.el9, mysql-shell 8.4.1-1.el9 --- 8.4/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index 607f9c54a..4268b2616 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.0-1.el9 +ENV MYSQL_VERSION 8.4.1-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.0-1.el9 +ENV MYSQL_SHELL_VERSION 8.4.1-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index b2ffb8c45..951d793b3 100644 --- a/versions.json +++ b/versions.json @@ -6,14 +6,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.0-1.el9", + "version": "8.4.1-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", - "version": "8.4.0-1.el9" + "version": "8.4.1-1.el9" }, - "version": "8.4.0" + "version": "8.4.1" }, "innovation": { "oracle": { From 9585da1f46f86c911324609626f2cdd709404081 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 1 Jul 2024 21:23:05 -0700 Subject: [PATCH 238/285] Update innovation to mysql-shell 9.0.0-1.el8 --- innovation/Dockerfile.oracle | 2 +- versions.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 847fb0ff4..c0908a5d4 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.0-1.el8 +ENV MYSQL_SHELL_VERSION 9.0.0-1.el8 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 951d793b3..9397d2a06 100644 --- a/versions.json +++ b/versions.json @@ -27,7 +27,7 @@ }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8", - "version": "8.4.0-1.el8" + "version": "9.0.0-1.el8" }, "version": "8.4.0" }, From 3d11822710789e82f64f08c578162a5b804d2f2f Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Tue, 2 Jul 2024 11:20:08 +0200 Subject: [PATCH 239/285] Use Oracle Linux 9 as base image for innovation image --- innovation/Dockerfile.oracle | 10 +++++----- versions.json | 26 +++++++++++++------------- versions.sh | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index c0908a5d4..7752a90db 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM oraclelinux:8-slim +FROM oraclelinux:9-slim RUN set -eux; \ groupadd --system --gid 999 mysql; \ @@ -56,14 +56,14 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 8.4.0-1.el8 +ENV MYSQL_VERSION 9.0.0-1.el9 RUN set -eu; \ { \ echo '[mysqlinnovation-server-minimal]'; \ echo 'name=MySQL innovation Server Minimal'; \ echo 'enabled=1'; \ - echo 'baseurl=https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8/$basearch/'; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9/$basearch/'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 @@ -100,14 +100,14 @@ RUN set -eu; \ { \ echo '[mysql-tools-community]'; \ echo 'name=MySQL Tools Community'; \ - echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8/$basearch/'; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9/$basearch/'; \ echo 'enabled=1'; \ echo 'gpgcheck=1'; \ echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 9.0.0-1.el8 +ENV MYSQL_SHELL_VERSION 9.0.0-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 9397d2a06..1cd5bc386 100644 --- a/versions.json +++ b/versions.json @@ -1,35 +1,35 @@ { - "8.4": { + "innovation": { "oracle": { "architectures": [ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.1-1.el9", + "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9", + "version": "9.0.0-1.el9", "variant": "9-slim" }, "mysql-shell": { - "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", - "version": "8.4.1-1.el9" + "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", + "version": "9.0.0-1.el9" }, - "version": "8.4.1" + "version": "9.0.0" }, - "innovation": { + "8.4": { "oracle": { "architectures": [ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/8", - "version": "8.4.0-1.el8", - "variant": "8-slim" + "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", + "version": "8.4.1-1.el9", + "variant": "9-slim" }, "mysql-shell": { - "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/8", - "version": "9.0.0-1.el8" + "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", + "version": "8.4.1-1.el9" }, - "version": "8.4.0" + "version": "8.4.1" }, "8.0": { "version": "8.0.38", diff --git a/versions.sh b/versions.sh index 3b0823e97..b3632f69f 100755 --- a/versions.sh +++ b/versions.sh @@ -8,7 +8,7 @@ declare -A debianSuites=( defaultOracleVariant='9-slim' declare -A oracleVariants=( - [innovation]='8-slim' + #[innovation]='8-slim' ) # https://repo.mysql.com/yum/mysql-8.0-community/docker/ From 8a3178fd2f84b610693bd4ba9d6bdf26215b04b8 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 9 Jul 2024 15:39:28 -0700 Subject: [PATCH 240/285] =?UTF-8?q?Update=20to=20actions/checkout@v4=20?= =?UTF-8?q?=F0=9F=99=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (this is effectively a functional no-op solving a "problem" that really ought to be solved at a different level within GHA) --- .github/workflows/ci.yml | 4 ++-- .github/workflows/verify-templating.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61ffb56ef..9e33b8bfa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: outputs: strategy: ${{ steps.generate-jobs.outputs.strategy }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: docker-library/bashbrew@HEAD - id: generate-jobs name: Generate Jobs @@ -44,7 +44,7 @@ jobs: name: ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Prepare Environment run: ${{ matrix.runs.prepare }} - name: Pull Dependencies diff --git a/.github/workflows/verify-templating.yml b/.github/workflows/verify-templating.yml index 14497bec6..2e1fb7872 100644 --- a/.github/workflows/verify-templating.yml +++ b/.github/workflows/verify-templating.yml @@ -13,7 +13,7 @@ jobs: name: Check For Uncomitted Changes runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Apply Templates run: ./apply-templates.sh - name: Check Git Status From 3e6dfd03b956727c7fb5b30360512a11751a3e9d Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 22 Jul 2024 15:26:32 -0700 Subject: [PATCH 241/285] Update 8.0 to 8.0.39, debian 8.0.39-1debian12, oracle 8.0.39-1.el9, mysql-shell 8.0.38-1.el9 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 2 +- versions.json | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 5e08f3f29..bca978fe6 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.38-1debian12 +ENV MYSQL_VERSION 8.0.39-1debian12 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index d18d98f26..c277b99db 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.38-1.el9 +ENV MYSQL_VERSION 8.0.39-1.el9 RUN set -eu; \ { \ diff --git a/versions.json b/versions.json index 1cd5bc386..9e7792788 100644 --- a/versions.json +++ b/versions.json @@ -32,13 +32,13 @@ "version": "8.4.1" }, "8.0": { - "version": "8.0.38", + "version": "8.0.39", "debian": { "architectures": [ "amd64" ], "suite": "bookworm", - "version": "8.0.38-1debian12" + "version": "8.0.39-1debian12" }, "oracle": { "architectures": [ @@ -46,7 +46,7 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", - "version": "8.0.38-1.el9", + "version": "8.0.39-1.el9", "variant": "9-slim" }, "mysql-shell": { From ea8ec8343c4540ac52e8bba94b5a531e298ff700 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 22 Jul 2024 15:32:47 -0700 Subject: [PATCH 242/285] Update 8.4 to 8.4.2, oracle 8.4.2-1.el9, mysql-shell 8.4.1-1.el9 --- 8.4/Dockerfile.oracle | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index 4268b2616..dc82de6dc 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.1-1.el9 +ENV MYSQL_VERSION 8.4.2-1.el9 RUN set -eu; \ { \ diff --git a/versions.json b/versions.json index 9e7792788..ccd0eb9a4 100644 --- a/versions.json +++ b/versions.json @@ -22,14 +22,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.1-1.el9", + "version": "8.4.2-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", "version": "8.4.1-1.el9" }, - "version": "8.4.1" + "version": "8.4.2" }, "8.0": { "version": "8.0.39", From a482468640c602ccd8a7c86a4c7422f18a307326 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 22 Jul 2024 15:36:10 -0700 Subject: [PATCH 243/285] Update innovation to 9.0.1, oracle 9.0.1-1.el9, mysql-shell 9.0.1-1.el9 --- innovation/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 7752a90db..0ad923264 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 9.0.0-1.el9 +ENV MYSQL_VERSION 9.0.1-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 9.0.0-1.el9 +ENV MYSQL_SHELL_VERSION 9.0.1-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index ccd0eb9a4..a0d9eec29 100644 --- a/versions.json +++ b/versions.json @@ -6,14 +6,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9", - "version": "9.0.0-1.el9", + "version": "9.0.1-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", - "version": "9.0.0-1.el9" + "version": "9.0.1-1.el9" }, - "version": "9.0.0" + "version": "9.0.1" }, "8.4": { "oracle": { From 090eb25ac69bca920fc5320484bc35aac92a8143 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 14 Oct 2024 15:15:13 -0700 Subject: [PATCH 244/285] Update 8.0 to 8.0.40, debian 8.0.40-1debian12, oracle 8.0.40-1.el9, mysql-shell 8.0.40-1.el9 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index bca978fe6..b1d306463 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.39-1debian12 +ENV MYSQL_VERSION 8.0.40-1debian12 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index c277b99db..c678f4f99 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.39-1.el9 +ENV MYSQL_VERSION 8.0.40-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.38-1.el9 +ENV MYSQL_SHELL_VERSION 8.0.40-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index a0d9eec29..a6da05cf8 100644 --- a/versions.json +++ b/versions.json @@ -32,13 +32,13 @@ "version": "8.4.2" }, "8.0": { - "version": "8.0.39", + "version": "8.0.40", "debian": { "architectures": [ "amd64" ], "suite": "bookworm", - "version": "8.0.39-1debian12" + "version": "8.0.40-1debian12" }, "oracle": { "architectures": [ @@ -46,12 +46,12 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", - "version": "8.0.39-1.el9", + "version": "8.0.40-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/9", - "version": "8.0.38-1.el9" + "version": "8.0.40-1.el9" } } } From 8a0100a365707fa3e59d5b23defc64b9314c4bc7 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 14 Oct 2024 15:21:37 -0700 Subject: [PATCH 245/285] Update 8.4 to 8.4.3, oracle 8.4.3-1.el9, mysql-shell 8.4.3-1.el9 --- 8.4/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index dc82de6dc..7ae37e9b3 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.2-1.el9 +ENV MYSQL_VERSION 8.4.3-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.1-1.el9 +ENV MYSQL_SHELL_VERSION 8.4.3-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index a6da05cf8..183e93a89 100644 --- a/versions.json +++ b/versions.json @@ -22,14 +22,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.2-1.el9", + "version": "8.4.3-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", - "version": "8.4.1-1.el9" + "version": "8.4.3-1.el9" }, - "version": "8.4.2" + "version": "8.4.3" }, "8.0": { "version": "8.0.40", From b7333451d7be9f066e43f9612e6bbe3751e548f1 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 14 Oct 2024 15:24:51 -0700 Subject: [PATCH 246/285] Update innovation to 9.1.0, oracle 9.1.0-1.el9, mysql-shell 9.1.0-1.el9 --- innovation/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 0ad923264..4afe70e5d 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 9.0.1-1.el9 +ENV MYSQL_VERSION 9.1.0-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 9.0.1-1.el9 +ENV MYSQL_SHELL_VERSION 9.1.0-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 183e93a89..8d5a01812 100644 --- a/versions.json +++ b/versions.json @@ -6,14 +6,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9", - "version": "9.0.1-1.el9", + "version": "9.1.0-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", - "version": "9.0.1-1.el9" + "version": "9.1.0-1.el9" }, - "version": "9.0.1" + "version": "9.1.0" }, "8.4": { "oracle": { From 15c0462dcd55f4d6ca7c57720903beca08b52665 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 16 Oct 2024 14:51:59 -0700 Subject: [PATCH 247/285] Use jq's `IN()` instead of `index()` The end result is the same, but the construction is more ergonomic. --- Dockerfile.debian | 2 +- Dockerfile.oracle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.debian b/Dockerfile.debian index 5df28c5bb..446179447 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -87,7 +87,7 @@ VOLUME /var/lib/mysql # Config files COPY config/ /etc/mysql/ COPY docker-entrypoint.sh /usr/local/bin/ -{{ if [ "8.0" ] | index(env.version) then ( -}} +{{ if env.version == "8.0" then ( -}} RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat {{ ) else "" end -}} ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/Dockerfile.oracle b/Dockerfile.oracle index 15fcabcad..39ba41692 100644 --- a/Dockerfile.oracle +++ b/Dockerfile.oracle @@ -132,7 +132,7 @@ RUN set -eux; \ VOLUME /var/lib/mysql COPY docker-entrypoint.sh /usr/local/bin/ -{{ if [ "8.0" ] | index(env.version) then ( -}} +{{ if env.version == "8.0" then ( -}} RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat {{ ) else "" end -}} ENTRYPOINT ["docker-entrypoint.sh"] From d4dd699b154d290ff04781ba56d9295b43734d5b Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 21 Nov 2024 10:49:45 -0800 Subject: [PATCH 248/285] Update README See https://github.com/docker-library/docs/pull/2503 --- README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/README.md b/README.md index a71f5b5ee..264e804a4 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,4 @@ For more information about the full official images change lifecycle, see [the " For outstanding `mysql` image PRs, check [PRs with the "library/mysql" label on the official-images repository](https://github.com/docker-library/official-images/labels/library%2Fmysql). For the current "source of truth" for [`mysql`](https://hub.docker.com/_/mysql/), see [the `library/mysql` file in the official-images repository](https://github.com/docker-library/official-images/blob/master/library/mysql). ---- - -- [![build status badge](https://img.shields.io/github/actions/workflow/status/docker-library/mysql/ci.yml?branch=master&label=GitHub%20CI)](https://github.com/docker-library/mysql/actions?query=workflow%3A%22GitHub+CI%22+branch%3Amaster) -- [![build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/mysql.svg?label=Automated%20update.sh)](https://doi-janky.infosiftr.net/job/update.sh/job/mysql/) - -| Build | Status | Badges | (per-arch) | -|:-:|:-:|:-:|:-:| -| [![amd64 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql.svg?label=amd64)](https://doi-janky.infosiftr.net/job/multiarch/job/amd64/job/mysql/) | [![arm64v8 build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/mysql.svg?label=arm64v8)](https://doi-janky.infosiftr.net/job/multiarch/job/arm64v8/job/mysql/) | [![put-shared build status badge](https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql.svg?label=put-shared)](https://doi-janky.infosiftr.net/job/put-shared/job/light/job/mysql/) | - From 7a02613b637f3b0fa56075663f5de8b3fba3dbee Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 13 Dec 2024 15:02:49 -0800 Subject: [PATCH 249/285] Simplify and update `verify-templating.yml` This makes it print out a diff when there is an error (instead of just a list of files that are wrong), which will make the error more obvious. I also added `workflow_dispatch` so we can run it manually. --- .github/workflows/verify-templating.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/verify-templating.yml b/.github/workflows/verify-templating.yml index 2e1fb7872..e822ba6bb 100644 --- a/.github/workflows/verify-templating.yml +++ b/.github/workflows/verify-templating.yml @@ -3,6 +3,7 @@ name: Verify Templating on: pull_request: push: + workflow_dispatch: defaults: run: @@ -14,9 +15,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Apply Templates - run: ./apply-templates.sh - - name: Check Git Status - run: | - status="$(git status --short)" - [ -z "$status" ] + - run: ./apply-templates.sh + - run: git diff --exit-code From 6978e12b0d46abf24015045bd22a0cf11b19c150 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 21 Jan 2025 09:15:14 -0800 Subject: [PATCH 250/285] Update 8.0 to 8.0.41, debian 8.0.41-1debian12, oracle 8.0.41-1.el9, mysql-shell 8.0.41-1.el9 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index b1d306463..a2393100f 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.40-1debian12 +ENV MYSQL_VERSION 8.0.41-1debian12 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index c678f4f99..ff4380f90 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.40-1.el9 +ENV MYSQL_VERSION 8.0.41-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.40-1.el9 +ENV MYSQL_SHELL_VERSION 8.0.41-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 8d5a01812..ccade9d46 100644 --- a/versions.json +++ b/versions.json @@ -32,13 +32,13 @@ "version": "8.4.3" }, "8.0": { - "version": "8.0.40", + "version": "8.0.41", "debian": { "architectures": [ "amd64" ], "suite": "bookworm", - "version": "8.0.40-1debian12" + "version": "8.0.41-1debian12" }, "oracle": { "architectures": [ @@ -46,12 +46,12 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", - "version": "8.0.40-1.el9", + "version": "8.0.41-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/9", - "version": "8.0.40-1.el9" + "version": "8.0.41-1.el9" } } } From 42386a0efb57a032d707e822086feea263088ad9 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 21 Jan 2025 09:21:51 -0800 Subject: [PATCH 251/285] Update 8.4 to 8.4.4, oracle 8.4.4-1.el9, mysql-shell 8.4.4-1.el9 --- 8.4/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index 7ae37e9b3..04cea7596 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.3-1.el9 +ENV MYSQL_VERSION 8.4.4-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.3-1.el9 +ENV MYSQL_SHELL_VERSION 8.4.4-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index ccade9d46..39914b947 100644 --- a/versions.json +++ b/versions.json @@ -22,14 +22,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.3-1.el9", + "version": "8.4.4-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", - "version": "8.4.3-1.el9" + "version": "8.4.4-1.el9" }, - "version": "8.4.3" + "version": "8.4.4" }, "8.0": { "version": "8.0.41", From 2615551146c34430e70aa42db0fce7bab7be6654 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 21 Jan 2025 09:25:08 -0800 Subject: [PATCH 252/285] Update innovation to 9.2.0, oracle 9.2.0-1.el9, mysql-shell 9.1.0-1.el9 --- innovation/Dockerfile.oracle | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 4afe70e5d..210858d27 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 9.1.0-1.el9 +ENV MYSQL_VERSION 9.2.0-1.el9 RUN set -eu; \ { \ diff --git a/versions.json b/versions.json index 39914b947..055f41c92 100644 --- a/versions.json +++ b/versions.json @@ -6,14 +6,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9", - "version": "9.1.0-1.el9", + "version": "9.2.0-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", "version": "9.1.0-1.el9" }, - "version": "9.1.0" + "version": "9.2.0" }, "8.4": { "oracle": { From df3a5c483a5e8c3c4d1eae61678fa5372c403bf0 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Wed, 22 Jan 2025 09:15:22 -0800 Subject: [PATCH 253/285] Update innovation to mysql-shell 9.2.0-1.el9 --- innovation/Dockerfile.oracle | 2 +- versions.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 210858d27..cf2c9bca5 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 9.1.0-1.el9 +ENV MYSQL_SHELL_VERSION 9.2.0-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 055f41c92..91a45f48d 100644 --- a/versions.json +++ b/versions.json @@ -11,7 +11,7 @@ }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", - "version": "9.1.0-1.el9" + "version": "9.2.0-1.el9" }, "version": "9.2.0" }, From 622dadf840144695eed3eefe4874ac95a71c3783 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 24 Mar 2025 16:35:54 -0700 Subject: [PATCH 254/285] Update shebang from /bin/bash to /usr/bin/env bash --- docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index e635e0762..0927b5ff8 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eo pipefail shopt -s nullglob From 3eee88bcaf4066ecef9edce0879053ce0dc3374b Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 24 Mar 2025 16:38:26 -0700 Subject: [PATCH 255/285] Update shebang from /bin/bash to /usr/bin/env bash --- 8.0/docker-entrypoint.sh | 2 +- 8.4/docker-entrypoint.sh | 2 +- innovation/docker-entrypoint.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh index e635e0762..0927b5ff8 100755 --- a/8.0/docker-entrypoint.sh +++ b/8.0/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eo pipefail shopt -s nullglob diff --git a/8.4/docker-entrypoint.sh b/8.4/docker-entrypoint.sh index e635e0762..0927b5ff8 100755 --- a/8.4/docker-entrypoint.sh +++ b/8.4/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eo pipefail shopt -s nullglob diff --git a/innovation/docker-entrypoint.sh b/innovation/docker-entrypoint.sh index e635e0762..0927b5ff8 100755 --- a/innovation/docker-entrypoint.sh +++ b/innovation/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -eo pipefail shopt -s nullglob From 94583e54d3bc02af523af720fdd58f8215287da9 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 14 Apr 2025 15:15:13 -0700 Subject: [PATCH 256/285] Update 8.0 to 8.0.42, debian 8.0.42-1debian12, oracle 8.0.42-1.el9, mysql-shell 8.0.42-1.el9 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index a2393100f..9a7d8240c 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.41-1debian12 +ENV MYSQL_VERSION 8.0.42-1debian12 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index ff4380f90..f53eb5574 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.41-1.el9 +ENV MYSQL_VERSION 8.0.42-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.41-1.el9 +ENV MYSQL_SHELL_VERSION 8.0.42-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 91a45f48d..06fdae753 100644 --- a/versions.json +++ b/versions.json @@ -32,13 +32,13 @@ "version": "8.4.4" }, "8.0": { - "version": "8.0.41", + "version": "8.0.42", "debian": { "architectures": [ "amd64" ], "suite": "bookworm", - "version": "8.0.41-1debian12" + "version": "8.0.42-1debian12" }, "oracle": { "architectures": [ @@ -46,12 +46,12 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", - "version": "8.0.41-1.el9", + "version": "8.0.42-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/9", - "version": "8.0.41-1.el9" + "version": "8.0.42-1.el9" } } } From 56251691b082d1aca21065a79a9d8e796daf3ea6 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 14 Apr 2025 15:21:58 -0700 Subject: [PATCH 257/285] Update 8.4 to 8.4.5, oracle 8.4.5-1.el9, mysql-shell 8.4.4-1.el9 --- 8.4/Dockerfile.oracle | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index 04cea7596..b97e9cbf6 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.4-1.el9 +ENV MYSQL_VERSION 8.4.5-1.el9 RUN set -eu; \ { \ diff --git a/versions.json b/versions.json index 06fdae753..4eae3690d 100644 --- a/versions.json +++ b/versions.json @@ -22,14 +22,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.4-1.el9", + "version": "8.4.5-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", "version": "8.4.4-1.el9" }, - "version": "8.4.4" + "version": "8.4.5" }, "8.0": { "version": "8.0.42", From 1b9d0c10ad8569c9419d76aacec9dbab23c48e9e Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 14 Apr 2025 15:25:44 -0700 Subject: [PATCH 258/285] Update innovation to 9.3.0, oracle 9.3.0-1.el9, mysql-shell 9.3.0-1.el9 --- innovation/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index cf2c9bca5..219ae5f27 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 9.2.0-1.el9 +ENV MYSQL_VERSION 9.3.0-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 9.2.0-1.el9 +ENV MYSQL_SHELL_VERSION 9.3.0-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 4eae3690d..647261223 100644 --- a/versions.json +++ b/versions.json @@ -6,14 +6,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9", - "version": "9.2.0-1.el9", + "version": "9.3.0-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", - "version": "9.2.0-1.el9" + "version": "9.3.0-1.el9" }, - "version": "9.2.0" + "version": "9.3.0" }, "8.4": { "oracle": { From 8ade9b2c9a32a79fbaa44b564d09a40744f1d105 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 15 Apr 2025 03:15:16 -0700 Subject: [PATCH 259/285] Update 8.4 to mysql-shell 8.4.5-1.el9 --- 8.4/Dockerfile.oracle | 2 +- versions.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index b97e9cbf6..ca971f8b4 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.4-1.el9 +ENV MYSQL_SHELL_VERSION 8.4.5-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 647261223..a57e40c6b 100644 --- a/versions.json +++ b/versions.json @@ -27,7 +27,7 @@ }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", - "version": "8.4.4-1.el9" + "version": "8.4.5-1.el9" }, "version": "8.4.5" }, From 516237cdb5e0991abc0c6dcbbc7a66cc6444d3a3 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 22 Jul 2025 09:15:22 -0700 Subject: [PATCH 260/285] Update 8.4 to 8.4.6, oracle 8.4.6-1.el9, mysql-shell 8.4.6-1.el9 --- 8.4/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index ca971f8b4..c771207b1 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.5-1.el9 +ENV MYSQL_VERSION 8.4.6-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.5-1.el9 +ENV MYSQL_SHELL_VERSION 8.4.6-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index a57e40c6b..945c9057a 100644 --- a/versions.json +++ b/versions.json @@ -22,14 +22,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.5-1.el9", + "version": "8.4.6-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", - "version": "8.4.5-1.el9" + "version": "8.4.6-1.el9" }, - "version": "8.4.5" + "version": "8.4.6" }, "8.0": { "version": "8.0.42", From cfdf0f31c85e777afa46157194ea8363dccc0260 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 22 Jul 2025 09:19:49 -0700 Subject: [PATCH 261/285] Update innovation to 9.4.0, oracle 9.4.0-1.el9, mysql-shell 9.4.0-1.el9 --- innovation/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 219ae5f27..8cb30e45f 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 9.3.0-1.el9 +ENV MYSQL_VERSION 9.4.0-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 9.3.0-1.el9 +ENV MYSQL_SHELL_VERSION 9.4.0-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 945c9057a..b6e9fc2db 100644 --- a/versions.json +++ b/versions.json @@ -6,14 +6,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9", - "version": "9.3.0-1.el9", + "version": "9.4.0-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", - "version": "9.3.0-1.el9" + "version": "9.4.0-1.el9" }, - "version": "9.3.0" + "version": "9.4.0" }, "8.4": { "oracle": { From 4ea634473f3ca9b1dcd476236e6d617258e2d63b Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 22 Jul 2025 15:15:12 -0700 Subject: [PATCH 262/285] Update 8.0 to 8.0.43, debian 8.0.43-1debian12, oracle 8.0.43-1.el9, mysql-shell 8.0.43-1.el9 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 9a7d8240c..8dbea685d 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.42-1debian12 +ENV MYSQL_VERSION 8.0.43-1debian12 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index f53eb5574..db4a2877e 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.42-1.el9 +ENV MYSQL_VERSION 8.0.43-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.42-1.el9 +ENV MYSQL_SHELL_VERSION 8.0.43-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index b6e9fc2db..1fe40bf6f 100644 --- a/versions.json +++ b/versions.json @@ -32,13 +32,13 @@ "version": "8.4.6" }, "8.0": { - "version": "8.0.42", + "version": "8.0.43", "debian": { "architectures": [ "amd64" ], "suite": "bookworm", - "version": "8.0.42-1debian12" + "version": "8.0.43-1debian12" }, "oracle": { "architectures": [ @@ -46,12 +46,12 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", - "version": "8.0.42-1.el9", + "version": "8.0.43-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/9", - "version": "8.0.42-1.el9" + "version": "8.0.43-1.el9" } } } From 9637f3b86a8bcdf852311299893a644f027d66ef Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 8 Sep 2025 13:09:09 -0700 Subject: [PATCH 263/285] Update gosu to 1.18 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 2 +- 8.4/Dockerfile.oracle | 2 +- Dockerfile.debian | 2 +- Dockerfile.oracle | 2 +- innovation/Dockerfile.oracle | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 8dbea685d..acbc5c2e7 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.17 +ENV GOSU_VERSION 1.18 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index db4a2877e..4f4ee8cbe 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -12,7 +12,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.17 +ENV GOSU_VERSION 1.18 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index c771207b1..901d57cf5 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -12,7 +12,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.17 +ENV GOSU_VERSION 1.18 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/Dockerfile.debian b/Dockerfile.debian index 446179447..ee0811fc6 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.17 +ENV GOSU_VERSION 1.18 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/Dockerfile.oracle b/Dockerfile.oracle index 39ba41692..739556d31 100644 --- a/Dockerfile.oracle +++ b/Dockerfile.oracle @@ -21,7 +21,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.17 +ENV GOSU_VERSION 1.18 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 8cb30e45f..0a4a2ca90 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -12,7 +12,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.17 +ENV GOSU_VERSION 1.18 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ From 7a5e9fbb739c7d423437b8687dfd400ea84fdb20 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 23 Sep 2025 12:30:29 -0700 Subject: [PATCH 264/285] Update gosu to 1.19 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 2 +- 8.4/Dockerfile.oracle | 2 +- Dockerfile.debian | 2 +- Dockerfile.oracle | 2 +- innovation/Dockerfile.oracle | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index acbc5c2e7..0715a9e65 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.18 +ENV GOSU_VERSION 1.19 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 4f4ee8cbe..82372cdea 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -12,7 +12,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.18 +ENV GOSU_VERSION 1.19 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index 901d57cf5..06eab73e7 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -12,7 +12,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.18 +ENV GOSU_VERSION 1.19 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/Dockerfile.debian b/Dockerfile.debian index ee0811fc6..d87e8df39 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.18 +ENV GOSU_VERSION 1.19 RUN set -eux; \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ diff --git a/Dockerfile.oracle b/Dockerfile.oracle index 739556d31..01d9ba7fe 100644 --- a/Dockerfile.oracle +++ b/Dockerfile.oracle @@ -21,7 +21,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.18 +ENV GOSU_VERSION 1.19 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 0a4a2ca90..0c30030e5 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -12,7 +12,7 @@ RUN set -eux; \ # add gosu for easy step-down from root # https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.18 +ENV GOSU_VERSION 1.19 RUN set -eux; \ # TODO find a better userspace architecture detection method than querying the kernel arch="$(uname -m)"; \ From ca7d66e7cb817097f7b3aec9497ba1ffcce230e7 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 21 Oct 2025 09:15:12 -0700 Subject: [PATCH 265/285] Update 8.0 to 8.0.44, debian 8.0.44-1debian12, oracle 8.0.44-1.el9, mysql-shell 8.0.44-1.el9 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 0715a9e65..085160a1e 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.43-1debian12 +ENV MYSQL_VERSION 8.0.44-1debian12 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 82372cdea..d659cebf6 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.43-1.el9 +ENV MYSQL_VERSION 8.0.44-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.43-1.el9 +ENV MYSQL_SHELL_VERSION 8.0.44-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 1fe40bf6f..200e90f28 100644 --- a/versions.json +++ b/versions.json @@ -32,13 +32,13 @@ "version": "8.4.6" }, "8.0": { - "version": "8.0.43", + "version": "8.0.44", "debian": { "architectures": [ "amd64" ], "suite": "bookworm", - "version": "8.0.43-1debian12" + "version": "8.0.44-1debian12" }, "oracle": { "architectures": [ @@ -46,12 +46,12 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", - "version": "8.0.43-1.el9", + "version": "8.0.44-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/9", - "version": "8.0.43-1.el9" + "version": "8.0.44-1.el9" } } } From ddb031e406121b1a298563775d521c044452a508 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 21 Oct 2025 09:22:14 -0700 Subject: [PATCH 266/285] Update 8.4 to 8.4.7, oracle 8.4.7-1.el9, mysql-shell 8.4.7-1.el9 --- 8.4/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index 06eab73e7..82258d3b3 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.6-1.el9 +ENV MYSQL_VERSION 8.4.7-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.6-1.el9 +ENV MYSQL_SHELL_VERSION 8.4.7-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 200e90f28..e180667af 100644 --- a/versions.json +++ b/versions.json @@ -22,14 +22,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.6-1.el9", + "version": "8.4.7-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", - "version": "8.4.6-1.el9" + "version": "8.4.7-1.el9" }, - "version": "8.4.6" + "version": "8.4.7" }, "8.0": { "version": "8.0.44", From 70c7d9777ced9f553109306404fe3c8700b3e9f7 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 21 Oct 2025 09:26:08 -0700 Subject: [PATCH 267/285] Update innovation to 9.5.0, oracle 9.5.0-1.el9, mysql-shell 9.5.0-1.el9 --- innovation/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 0c30030e5..f5ab7ab69 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 9.4.0-1.el9 +ENV MYSQL_VERSION 9.5.0-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 9.4.0-1.el9 +ENV MYSQL_SHELL_VERSION 9.5.0-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index e180667af..f465a76ae 100644 --- a/versions.json +++ b/versions.json @@ -6,14 +6,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9", - "version": "9.4.0-1.el9", + "version": "9.5.0-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", - "version": "9.4.0-1.el9" + "version": "9.5.0-1.el9" }, - "version": "9.4.0" + "version": "9.5.0" }, "8.4": { "oracle": { From 4b1eb6077861399b8ff8c94d74fd99ad972cf031 Mon Sep 17 00:00:00 2001 From: Joseph Ferguson Date: Thu, 23 Oct 2025 11:01:50 -0700 Subject: [PATCH 268/285] update mysql key comment with new expiration --- 8.0/Dockerfile.debian | 4 ++-- Dockerfile.debian | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index 085160a1e..afa74763c 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -53,10 +53,10 @@ RUN set -eux; \ rm -rf /var/lib/apt/lists/* RUN set -eux; \ -# pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] +# pub rsa4096 2023-10-23 [SC] [expires: 2027-10-23] # BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C # uid [ unknown] MySQL Release Engineering -# sub rsa4096 2023-10-23 [E] [expires: 2025-10-22] +# sub rsa4096 2023-10-23 [E] [expires: 2027-10-23] key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ diff --git a/Dockerfile.debian b/Dockerfile.debian index d87e8df39..0db1ae04d 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -47,10 +47,10 @@ RUN set -eux; \ rm -rf /var/lib/apt/lists/* RUN set -eux; \ -# pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] +# pub rsa4096 2023-10-23 [SC] [expires: 2027-10-23] # BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C # uid [ unknown] MySQL Release Engineering -# sub rsa4096 2023-10-23 [E] [expires: 2025-10-22] +# sub rsa4096 2023-10-23 [E] [expires: 2027-10-23] key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ From 7a8f81aad11e871baf1dbc755dbff1652e13cba5 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Wed, 21 Jan 2026 03:15:24 -0800 Subject: [PATCH 269/285] Update 8.0 to 8.0.45, debian 8.0.45-1debian12, oracle 8.0.45-1.el9, mysql-shell 8.0.45-1.el9 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index afa74763c..e7dc85c35 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.44-1debian12 +ENV MYSQL_VERSION 8.0.45-1debian12 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index d659cebf6..8ac845ebb 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.44-1.el9 +ENV MYSQL_VERSION 8.0.45-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.44-1.el9 +ENV MYSQL_SHELL_VERSION 8.0.45-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index f465a76ae..d8dab4e7d 100644 --- a/versions.json +++ b/versions.json @@ -32,13 +32,13 @@ "version": "8.4.7" }, "8.0": { - "version": "8.0.44", + "version": "8.0.45", "debian": { "architectures": [ "amd64" ], "suite": "bookworm", - "version": "8.0.44-1debian12" + "version": "8.0.45-1debian12" }, "oracle": { "architectures": [ @@ -46,12 +46,12 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", - "version": "8.0.44-1.el9", + "version": "8.0.45-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/9", - "version": "8.0.44-1.el9" + "version": "8.0.45-1.el9" } } } From 9dc8e79d60e4b10f30eb040ebd2d6c0f63b737bd Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Wed, 21 Jan 2026 03:22:32 -0800 Subject: [PATCH 270/285] Update 8.4 to 8.4.8, oracle 8.4.8-1.el9, mysql-shell 8.4.8-1.el9 --- 8.4/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index 82258d3b3..172325694 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.7-1.el9 +ENV MYSQL_VERSION 8.4.8-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.7-1.el9 +ENV MYSQL_SHELL_VERSION 8.4.8-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index d8dab4e7d..3698f8547 100644 --- a/versions.json +++ b/versions.json @@ -22,14 +22,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.7-1.el9", + "version": "8.4.8-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", - "version": "8.4.7-1.el9" + "version": "8.4.8-1.el9" }, - "version": "8.4.7" + "version": "8.4.8" }, "8.0": { "version": "8.0.45", From f8c2facfccdc3c8b8b2c9b5a6aec31db3115105b Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Wed, 21 Jan 2026 03:26:22 -0800 Subject: [PATCH 271/285] Update innovation to 9.6.0, oracle 9.6.0-1.el9, mysql-shell 9.6.0-1.el9 --- innovation/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index f5ab7ab69..39f4c11e0 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 9.5.0-1.el9 +ENV MYSQL_VERSION 9.6.0-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 9.5.0-1.el9 +ENV MYSQL_SHELL_VERSION 9.6.0-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 3698f8547..211beaee9 100644 --- a/versions.json +++ b/versions.json @@ -6,14 +6,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9", - "version": "9.5.0-1.el9", + "version": "9.6.0-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", - "version": "9.5.0-1.el9" + "version": "9.6.0-1.el9" }, - "version": "9.5.0" + "version": "9.6.0" }, "8.4": { "oracle": { From c89645cbda51d0e572661774a2318c8d21cf3537 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Thu, 9 Apr 2026 14:15:29 -0700 Subject: [PATCH 272/285] Update 8.4 --- versions.json | 1 - 1 file changed, 1 deletion(-) diff --git a/versions.json b/versions.json index 211beaee9..863527548 100644 --- a/versions.json +++ b/versions.json @@ -18,7 +18,6 @@ "8.4": { "oracle": { "architectures": [ - "amd64", "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", From a77e5d5e21a87a013cc06d583371d2224fc4fb09 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Thu, 9 Apr 2026 15:22:40 -0700 Subject: [PATCH 273/285] Update 8.4 --- versions.json | 1 + 1 file changed, 1 insertion(+) diff --git a/versions.json b/versions.json index 863527548..211beaee9 100644 --- a/versions.json +++ b/versions.json @@ -18,6 +18,7 @@ "8.4": { "oracle": { "architectures": [ + "amd64", "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", From 7fcf7198cf8be286bae76a4b587ac206af3e7cd8 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 20 Apr 2026 14:20:03 -0700 Subject: [PATCH 274/285] Update 8.4 to 8.4.9, oracle 8.4.9-1.el9, mysql-shell 8.4.9-1.el9 --- 8.4/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index 172325694..0ea34975d 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.8-1.el9 +ENV MYSQL_VERSION 8.4.9-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.8-1.el9 +ENV MYSQL_SHELL_VERSION 8.4.9-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 211beaee9..60b0faa16 100644 --- a/versions.json +++ b/versions.json @@ -22,14 +22,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.8-1.el9", + "version": "8.4.9-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", - "version": "8.4.8-1.el9" + "version": "8.4.9-1.el9" }, - "version": "8.4.8" + "version": "8.4.9" }, "8.0": { "version": "8.0.45", From 7cf11d5360282effadb347353d5f82339506b106 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 21 Apr 2026 14:15:10 -0700 Subject: [PATCH 275/285] Update 8.0 to 8.0.46, debian 8.0.46-1debian12, oracle 8.0.46-1.el9, mysql-shell 8.0.46-1.el9 --- 8.0/Dockerfile.debian | 2 +- 8.0/Dockerfile.oracle | 4 ++-- versions.json | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian index e7dc85c35..743dd55bf 100644 --- a/8.0/Dockerfile.debian +++ b/8.0/Dockerfile.debian @@ -66,7 +66,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.45-1debian12 +ENV MYSQL_VERSION 8.0.46-1debian12 RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle index 8ac845ebb..6c6e12b0b 100644 --- a/8.0/Dockerfile.oracle +++ b/8.0/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.45-1.el9 +ENV MYSQL_VERSION 8.0.46-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.45-1.el9 +ENV MYSQL_SHELL_VERSION 8.0.46-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 60b0faa16..21a802b43 100644 --- a/versions.json +++ b/versions.json @@ -32,13 +32,13 @@ "version": "8.4.9" }, "8.0": { - "version": "8.0.45", + "version": "8.0.46", "debian": { "architectures": [ "amd64" ], "suite": "bookworm", - "version": "8.0.45-1debian12" + "version": "8.0.46-1debian12" }, "oracle": { "architectures": [ @@ -46,12 +46,12 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", - "version": "8.0.45-1.el9", + "version": "8.0.46-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/9", - "version": "8.0.45-1.el9" + "version": "8.0.46-1.el9" } } } From 42686d1c1bba5b1e4f332ef802fdabc8fedae1a7 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Wed, 22 Apr 2026 08:44:19 +0200 Subject: [PATCH 276/285] Add 9.7 (LTS) variant --- 9.7/Dockerfile.oracle | 123 ++++++++++++ 9.7/docker-entrypoint.sh | 420 +++++++++++++++++++++++++++++++++++++++ versions.json | 16 ++ 3 files changed, 559 insertions(+) create mode 100644 9.7/Dockerfile.oracle create mode 100755 9.7/docker-entrypoint.sh diff --git a/9.7/Dockerfile.oracle b/9.7/Dockerfile.oracle new file mode 100644 index 000000000..a7535e806 --- /dev/null +++ b/9.7/Dockerfile.oracle @@ -0,0 +1,123 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM oraclelinux:9-slim + +RUN set -eux; \ + groupadd --system --gid 999 mysql; \ + useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql + +# add gosu for easy step-down from root +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.19 +RUN set -eux; \ +# TODO find a better userspace architecture detection method than querying the kernel + arch="$(uname -m)"; \ + case "$arch" in \ + aarch64) gosuArch='arm64' ;; \ + x86_64) gosuArch='amd64' ;; \ + *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ + esac; \ + curl -fL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch.asc"; \ + curl -fL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true + +RUN set -eux; \ + microdnf install -y \ + bzip2 \ + gzip \ + openssl \ + xz \ + zstd \ +# Oracle Linux 8+ is very slim :) + findutils \ + ; \ + microdnf clean all + +RUN set -eux; \ +# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html +# pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] +# BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C +# uid [ unknown] MySQL Release Engineering +# sub rsa4096 2023-10-23 [E] [expires: 2025-10-22] + key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ + gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ + rm -rf "$GNUPGHOME" + +ENV MYSQL_MAJOR 9.7 +ENV MYSQL_VERSION 9.7.0-1.el9 + +RUN set -eu; \ + { \ + echo '[mysql9.7-server-minimal]'; \ + echo 'name=MySQL 9.7 Server Minimal'; \ + echo 'enabled=1'; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-9.7-community/docker/el/9/$basearch/'; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-minimal.repo + +RUN set -eux; \ + microdnf install -y "mysql-community-server-minimal-$MYSQL_VERSION"; \ + microdnf clean all; \ +# the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead) +# https://github.com/docker-library/mysql/pull/680#issuecomment-636121520 + grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ + sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ + grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ + { echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf; \ + \ +# make sure users dumping files in "/etc/mysql/conf.d" still works + ! grep -F '!includedir' /etc/my.cnf; \ + { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ + mkdir -p /etc/mysql/conf.d; \ +# ensure these directories exist and have useful permissions +# the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install + mkdir -p /var/lib/mysql /var/run/mysqld; \ + chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ +# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime + chmod 1777 /var/lib/mysql /var/run/mysqld; \ + \ + mkdir /docker-entrypoint-initdb.d; \ + \ + mysqld --version; \ + mysql --version + +RUN set -eu; \ + { \ + echo '[mysql-tools-community]'; \ + echo 'name=MySQL Tools Community'; \ + echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-9.7-community/el/9/$basearch/'; \ + echo 'enabled=1'; \ + echo 'gpgcheck=1'; \ + echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ +# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 + echo 'module_hotfixes=true'; \ + } | tee /etc/yum.repos.d/mysql-community-tools.repo +ENV MYSQL_SHELL_VERSION 9.7.0-1.el9 +RUN set -eux; \ + microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ + microdnf clean all; \ + \ + mysqlsh --version + +VOLUME /var/lib/mysql + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 3306 33060 +CMD ["mysqld"] diff --git a/9.7/docker-entrypoint.sh b/9.7/docker-entrypoint.sh new file mode 100755 index 000000000..0927b5ff8 --- /dev/null +++ b/9.7/docker-entrypoint.sh @@ -0,0 +1,420 @@ +#!/usr/bin/env bash +set -eo pipefail +shopt -s nullglob + +# logging functions +mysql_log() { + local type="$1"; shift + # accept argument string or stdin + local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi + local dt; dt="$(date --rfc-3339=seconds)" + printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text" +} +mysql_note() { + mysql_log Note "$@" +} +mysql_warn() { + mysql_log Warn "$@" >&2 +} +mysql_error() { + mysql_log ERROR "$@" >&2 + exit 1 +} + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + mysql_error "Both $var and $fileVar are set (but are exclusive)" + fi + local val="$def" + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + export "$var"="$val" + unset "$fileVar" +} + +# check to see if this file is being run or sourced from another script +_is_sourced() { + # https://unix.stackexchange.com/a/215279 + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] +} + +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions +docker_process_init_files() { + # mysql here for backwards compatibility "${mysql[@]}" + mysql=( docker_process_sql ) + + echo + local f + for f; do + case "$f" in + *.sh) + # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 + # https://github.com/docker-library/postgres/pull/452 + if [ -x "$f" ]; then + mysql_note "$0: running $f" + "$f" + else + mysql_note "$0: sourcing $f" + . "$f" + fi + ;; + *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; + *.sql.bz2) mysql_note "$0: running $f"; bunzip2 -c "$f" | docker_process_sql; echo ;; + *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; + *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; + *) mysql_warn "$0: ignoring $f" ;; + esac + echo + done +} + +# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) +_verboseHelpArgs=( + --verbose --help + --log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136 +) + +mysql_check_config() { + local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors + if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then + mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" + fi +} + +# Fetch value from server config +# We use mysqld --verbose --help instead of my_print_defaults because the +# latter only show values present in config files, and not server defaults +mysql_get_config() { + local conf="$1"; shift + "$@" "${_verboseHelpArgs[@]}" 2>/dev/null \ + | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' + # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" +} + +# Ensure that the package default socket can also be used +# since rpm packages are compiled with a different socket location +# and "mysqlsh --mysql" doesn't read the [client] config +# related to https://github.com/docker-library/mysql/issues/829 +mysql_socket_fix() { + local defaultSocket + defaultSocket="$(mysql_get_config 'socket' mysqld --no-defaults)" + if [ "$defaultSocket" != "$SOCKET" ]; then + ln -sfTv "$SOCKET" "$defaultSocket" || : + fi +} + +# Do a temporary startup of the MySQL server, for init purposes +docker_temp_server_start() { + # For 5.7+ the server is ready for use as soon as startup command unblocks + if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then + mysql_error "Unable to start server." + fi +} + +# Stop the server. When using a local socket file mysqladmin will block until +# the shutdown is complete. +docker_temp_server_stop() { + if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then + mysql_error "Unable to shut down server." + fi +} + +# Verify that the minimally required password settings are set for new databases. +docker_verify_minimum_env() { + if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then + mysql_error <<-'EOF' + Database is uninitialized and password option is not specified + You need to specify one of the following as an environment variable: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) + if [ "$MYSQL_USER" = 'root' ]; then + mysql_error <<-'EOF' + MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user + Remove MYSQL_USER="root" and use one of the following to control the root user password: + - MYSQL_ROOT_PASSWORD + - MYSQL_ALLOW_EMPTY_PASSWORD + - MYSQL_RANDOM_ROOT_PASSWORD + EOF + fi + + # warn when missing one of MYSQL_USER or MYSQL_PASSWORD + if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created' + elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then + mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored' + fi +} + +# creates folders for the database +# also ensures permission for user mysql of run as root +docker_create_db_directories() { + local user; user="$(id -u)" + + local -A dirs=( ["$DATADIR"]=1 ) + local dir + dir="$(dirname "$SOCKET")" + dirs["$dir"]=1 + + # "datadir" and "socket" are already handled above (since they were already queried previously) + local conf + for conf in \ + general-log-file \ + keyring_file_data \ + pid-file \ + secure-file-priv \ + slow-query-log-file \ + ; do + dir="$(mysql_get_config "$conf" "$@")" + + # skip empty values + if [ -z "$dir" ] || [ "$dir" = 'NULL' ]; then + continue + fi + case "$conf" in + secure-file-priv) + # already points at a directory + ;; + *) + # other config options point at a file, but we need the directory + dir="$(dirname "$dir")" + ;; + esac + + dirs["$dir"]=1 + done + + mkdir -p "${!dirs[@]}" + + if [ "$user" = "0" ]; then + # this will cause less disk access than `chown -R` + find "${!dirs[@]}" \! -user mysql -exec chown --no-dereference mysql '{}' + + fi +} + +# initializes the database directory +docker_init_database_dir() { + mysql_note "Initializing database files" + "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1 + # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a) + mysql_note "Database files initialized" +} + +# Loads various settings that are used elsewhere in the script +# This should be called after mysql_check_config, but before any other functions +docker_setup_env() { + # Get config + declare -g DATADIR SOCKET + DATADIR="$(mysql_get_config 'datadir' "$@")" + SOCKET="$(mysql_get_config 'socket' "$@")" + + # Initialize values that might be stored in a file + file_env 'MYSQL_ROOT_HOST' '%' + file_env 'MYSQL_DATABASE' + file_env 'MYSQL_USER' + file_env 'MYSQL_PASSWORD' + file_env 'MYSQL_ROOT_PASSWORD' + + declare -g DATABASE_ALREADY_EXISTS + if [ -d "$DATADIR/mysql" ]; then + DATABASE_ALREADY_EXISTS='true' + fi +} + +# Execute sql script, passed via stdin +# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args] +# ie: docker_process_sql --database=mydb <<<'INSERT ...' +# ie: docker_process_sql --dont-use-mysql-root-password --database=mydb /dev/null + + docker_init_database_dir "$@" + + mysql_note "Starting temporary server" + docker_temp_server_start "$@" + mysql_note "Temporary server started." + + mysql_socket_fix + docker_setup_db + docker_process_init_files /docker-entrypoint-initdb.d/* + + mysql_expire_root_user + + mysql_note "Stopping temporary server" + docker_temp_server_stop + mysql_note "Temporary server stopped" + + echo + mysql_note "MySQL init process done. Ready for start up." + echo + else + mysql_socket_fix + fi + fi + exec "$@" +} + +# If we are sourced from elsewhere, don't perform any further actions +if ! _is_sourced; then + _main "$@" +fi diff --git a/versions.json b/versions.json index 21a802b43..00b95004c 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,20 @@ { + "9.7": { + "oracle": { + "architectures": [ + "amd64", + "arm64v8" + ], + "repo": "https://repo.mysql.com/yum/mysql-9.7-community/docker/el/9", + "version": "9.7.0-1.el9", + "variant": "9-slim" + }, + "mysql-shell": { + "repo": "https://repo.mysql.com/yum/mysql-tools-9.7-community/el/9", + "version": "9.7.0-1.el9" + }, + "version": "9.7.0" + }, "innovation": { "oracle": { "architectures": [ From eb985a270a567fa2619c878e6d6794541d7eec17 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Wed, 22 Apr 2026 08:44:41 +0200 Subject: [PATCH 277/285] Move lts alias to 9.7 --- generate-stackbrew-library.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 485cbb5b0..ec705fbff 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -2,7 +2,8 @@ set -Eeuo pipefail declare -A aliases=( - [8.4]='8 lts' + [8.4]='8' + [9.7]='9 lts' ) defaultDefaultVariant='oracle' From b6c1f3997a86ad4de7ceb6b8c9b0d9f6ee15ac84 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Wed, 22 Apr 2026 08:56:51 +0200 Subject: [PATCH 278/285] Remove 8.0 (EOL) --- 8.0/Dockerfile.debian | 100 --------- 8.0/Dockerfile.oracle | 124 ----------- 8.0/config/conf.d/docker.cnf | 3 - 8.0/config/my.cnf | 29 --- 8.0/docker-entrypoint.sh | 420 ----------------------------------- versions.json | 23 -- 6 files changed, 699 deletions(-) delete mode 100644 8.0/Dockerfile.debian delete mode 100644 8.0/Dockerfile.oracle delete mode 100644 8.0/config/conf.d/docker.cnf delete mode 100644 8.0/config/my.cnf delete mode 100755 8.0/docker-entrypoint.sh diff --git a/8.0/Dockerfile.debian b/8.0/Dockerfile.debian deleted file mode 100644 index 743dd55bf..000000000 --- a/8.0/Dockerfile.debian +++ /dev/null @@ -1,100 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:bookworm-slim - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN groupadd -r mysql && useradd -r -g mysql mysql - -RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf /var/lib/apt/lists/* - -# add gosu for easy step-down from root -# https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.19 -RUN set -eux; \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends ca-certificates wget; \ - rm -rf /var/lib/apt/lists/*; \ - dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ - wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ - wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ - gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - chmod +x /usr/local/bin/gosu; \ - gosu --version; \ - gosu nobody true - -RUN mkdir /docker-entrypoint-initdb.d - -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - bzip2 \ - openssl \ -# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: -# File::Basename -# File::Copy -# Sys::Hostname -# Data::Dumper - perl \ - xz-utils \ - zstd \ - ; \ - rm -rf /var/lib/apt/lists/* - -RUN set -eux; \ -# pub rsa4096 2023-10-23 [SC] [expires: 2027-10-23] -# BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C -# uid [ unknown] MySQL Release Engineering -# sub rsa4096 2023-10-23 [E] [expires: 2027-10-23] - key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - mkdir -p /etc/apt/keyrings; \ - gpg --batch --export "$key" > /etc/apt/keyrings/mysql.gpg; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME" - -ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.46-1debian12 - -RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql.list - -# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) -# also, we set debconf keys to make APT a little quieter -RUN { \ - echo mysql-community-server mysql-community-server/data-dir select ''; \ - echo mysql-community-server mysql-community-server/root-pass password ''; \ - echo mysql-community-server mysql-community-server/re-root-pass password ''; \ - echo mysql-community-server mysql-community-server/remove-test-db select false; \ - } | debconf-set-selections \ - && apt-get update \ - && apt-get install -y \ - mysql-community-client="${MYSQL_VERSION}" \ - mysql-community-server-core="${MYSQL_VERSION}" \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ - && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 1777 /var/run/mysqld /var/lib/mysql - -VOLUME /var/lib/mysql - -# Config files -COPY config/ /etc/mysql/ -COPY docker-entrypoint.sh /usr/local/bin/ -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -EXPOSE 3306 33060 -CMD ["mysqld"] diff --git a/8.0/Dockerfile.oracle b/8.0/Dockerfile.oracle deleted file mode 100644 index 6c6e12b0b..000000000 --- a/8.0/Dockerfile.oracle +++ /dev/null @@ -1,124 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM oraclelinux:9-slim - -RUN set -eux; \ - groupadd --system --gid 999 mysql; \ - useradd --system --uid 999 --gid 999 --home-dir /var/lib/mysql --no-create-home mysql - -# add gosu for easy step-down from root -# https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.19 -RUN set -eux; \ -# TODO find a better userspace architecture detection method than querying the kernel - arch="$(uname -m)"; \ - case "$arch" in \ - aarch64) gosuArch='arm64' ;; \ - x86_64) gosuArch='amd64' ;; \ - *) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;; \ - esac; \ - curl -fL -o /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch.asc"; \ - curl -fL -o /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$gosuArch"; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ - gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ - rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ - chmod +x /usr/local/bin/gosu; \ - gosu --version; \ - gosu nobody true - -RUN set -eux; \ - microdnf install -y \ - bzip2 \ - gzip \ - openssl \ - xz \ - zstd \ -# Oracle Linux 8+ is very slim :) - findutils \ - ; \ - microdnf clean all - -RUN set -eux; \ -# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html -# pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] -# BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C -# uid [ unknown] MySQL Release Engineering -# sub rsa4096 2023-10-23 [E] [expires: 2025-10-22] - key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \ - rm -rf "$GNUPGHOME" - -ENV MYSQL_MAJOR 8.0 -ENV MYSQL_VERSION 8.0.46-1.el9 - -RUN set -eu; \ - { \ - echo '[mysql8.0-server-minimal]'; \ - echo 'name=MySQL 8.0 Server Minimal'; \ - echo 'enabled=1'; \ - echo 'baseurl=https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9/$basearch/'; \ - echo 'gpgcheck=1'; \ - echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ -# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 - echo 'module_hotfixes=true'; \ - } | tee /etc/yum.repos.d/mysql-community-minimal.repo - -RUN set -eux; \ - microdnf install -y "mysql-community-server-minimal-$MYSQL_VERSION"; \ - microdnf clean all; \ -# the "socket" value in the Oracle packages is set to "/var/lib/mysql" which isn't a great place for the socket (we want it in "/var/run/mysqld" instead) -# https://github.com/docker-library/mysql/pull/680#issuecomment-636121520 - grep -F 'socket=/var/lib/mysql/mysql.sock' /etc/my.cnf; \ - sed -i 's!^socket=.*!socket=/var/run/mysqld/mysqld.sock!' /etc/my.cnf; \ - grep -F 'socket=/var/run/mysqld/mysqld.sock' /etc/my.cnf; \ - { echo '[client]'; echo 'socket=/var/run/mysqld/mysqld.sock'; } >> /etc/my.cnf; \ - \ -# make sure users dumping files in "/etc/mysql/conf.d" still works - ! grep -F '!includedir' /etc/my.cnf; \ - { echo; echo '!includedir /etc/mysql/conf.d/'; } >> /etc/my.cnf; \ - mkdir -p /etc/mysql/conf.d; \ -# ensure these directories exist and have useful permissions -# the rpm package has different opinions on the mode of `/var/run/mysqld`, so this needs to be after install - mkdir -p /var/lib/mysql /var/run/mysqld; \ - chown mysql:mysql /var/lib/mysql /var/run/mysqld; \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - chmod 1777 /var/lib/mysql /var/run/mysqld; \ - \ - mkdir /docker-entrypoint-initdb.d; \ - \ - mysqld --version; \ - mysql --version - -RUN set -eu; \ - { \ - echo '[mysql-tools-community]'; \ - echo 'name=MySQL Tools Community'; \ - echo 'baseurl=https://repo.mysql.com/yum/mysql-tools-community/el/9/$basearch/'; \ - echo 'enabled=1'; \ - echo 'gpgcheck=1'; \ - echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql'; \ -# https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 - echo 'module_hotfixes=true'; \ - } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.0.46-1.el9 -RUN set -eux; \ - microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ - microdnf clean all; \ - \ - mysqlsh --version - -VOLUME /var/lib/mysql - -COPY docker-entrypoint.sh /usr/local/bin/ -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -ENTRYPOINT ["docker-entrypoint.sh"] - -EXPOSE 3306 33060 -CMD ["mysqld"] diff --git a/8.0/config/conf.d/docker.cnf b/8.0/config/conf.d/docker.cnf deleted file mode 100644 index 205bedb54..000000000 --- a/8.0/config/conf.d/docker.cnf +++ /dev/null @@ -1,3 +0,0 @@ -[mysqld] -host_cache_size=0 -skip-name-resolve diff --git a/8.0/config/my.cnf b/8.0/config/my.cnf deleted file mode 100644 index 1f2511ce6..000000000 --- a/8.0/config/my.cnf +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# -# The MySQL Server configuration file. -# -# For explanations see -# http://dev.mysql.com/doc/mysql/en/server-system-variables.html - -[mysqld] -pid-file = /var/run/mysqld/mysqld.pid -socket = /var/run/mysqld/mysqld.sock -datadir = /var/lib/mysql -secure-file-priv= NULL - -# Custom config should go here -!includedir /etc/mysql/conf.d/ diff --git a/8.0/docker-entrypoint.sh b/8.0/docker-entrypoint.sh deleted file mode 100755 index 0927b5ff8..000000000 --- a/8.0/docker-entrypoint.sh +++ /dev/null @@ -1,420 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail -shopt -s nullglob - -# logging functions -mysql_log() { - local type="$1"; shift - # accept argument string or stdin - local text="$*"; if [ "$#" -eq 0 ]; then text="$(cat)"; fi - local dt; dt="$(date --rfc-3339=seconds)" - printf '%s [%s] [Entrypoint]: %s\n' "$dt" "$type" "$text" -} -mysql_note() { - mysql_log Note "$@" -} -mysql_warn() { - mysql_log Warn "$@" >&2 -} -mysql_error() { - mysql_log ERROR "$@" >&2 - exit 1 -} - -# usage: file_env VAR [DEFAULT] -# ie: file_env 'XYZ_DB_PASSWORD' 'example' -# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of -# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) -file_env() { - local var="$1" - local fileVar="${var}_FILE" - local def="${2:-}" - if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then - mysql_error "Both $var and $fileVar are set (but are exclusive)" - fi - local val="$def" - if [ "${!var:-}" ]; then - val="${!var}" - elif [ "${!fileVar:-}" ]; then - val="$(< "${!fileVar}")" - fi - export "$var"="$val" - unset "$fileVar" -} - -# check to see if this file is being run or sourced from another script -_is_sourced() { - # https://unix.stackexchange.com/a/215279 - [ "${#FUNCNAME[@]}" -ge 2 ] \ - && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ - && [ "${FUNCNAME[1]}" = 'source' ] -} - -# usage: docker_process_init_files [file [file [...]]] -# ie: docker_process_init_files /always-initdb.d/* -# process initializer files, based on file extensions -docker_process_init_files() { - # mysql here for backwards compatibility "${mysql[@]}" - mysql=( docker_process_sql ) - - echo - local f - for f; do - case "$f" in - *.sh) - # https://github.com/docker-library/postgres/issues/450#issuecomment-393167936 - # https://github.com/docker-library/postgres/pull/452 - if [ -x "$f" ]; then - mysql_note "$0: running $f" - "$f" - else - mysql_note "$0: sourcing $f" - . "$f" - fi - ;; - *.sql) mysql_note "$0: running $f"; docker_process_sql < "$f"; echo ;; - *.sql.bz2) mysql_note "$0: running $f"; bunzip2 -c "$f" | docker_process_sql; echo ;; - *.sql.gz) mysql_note "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; - *.sql.xz) mysql_note "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; - *.sql.zst) mysql_note "$0: running $f"; zstd -dc "$f" | docker_process_sql; echo ;; - *) mysql_warn "$0: ignoring $f" ;; - esac - echo - done -} - -# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) -_verboseHelpArgs=( - --verbose --help - --log-bin-index="$(mktemp -u)" # https://github.com/docker-library/mysql/issues/136 -) - -mysql_check_config() { - local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors - if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then - mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" - fi -} - -# Fetch value from server config -# We use mysqld --verbose --help instead of my_print_defaults because the -# latter only show values present in config files, and not server defaults -mysql_get_config() { - local conf="$1"; shift - "$@" "${_verboseHelpArgs[@]}" 2>/dev/null \ - | awk -v conf="$conf" '$1 == conf && /^[^ \t]/ { sub(/^[^ \t]+[ \t]+/, ""); print; exit }' - # match "datadir /some/path with/spaces in/it here" but not "--xyz=abc\n datadir (xyz)" -} - -# Ensure that the package default socket can also be used -# since rpm packages are compiled with a different socket location -# and "mysqlsh --mysql" doesn't read the [client] config -# related to https://github.com/docker-library/mysql/issues/829 -mysql_socket_fix() { - local defaultSocket - defaultSocket="$(mysql_get_config 'socket' mysqld --no-defaults)" - if [ "$defaultSocket" != "$SOCKET" ]; then - ln -sfTv "$SOCKET" "$defaultSocket" || : - fi -} - -# Do a temporary startup of the MySQL server, for init purposes -docker_temp_server_start() { - # For 5.7+ the server is ready for use as soon as startup command unblocks - if ! "$@" --daemonize --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}"; then - mysql_error "Unable to start server." - fi -} - -# Stop the server. When using a local socket file mysqladmin will block until -# the shutdown is complete. -docker_temp_server_stop() { - if ! mysqladmin --defaults-extra-file=<( _mysql_passfile ) shutdown -uroot --socket="${SOCKET}"; then - mysql_error "Unable to shut down server." - fi -} - -# Verify that the minimally required password settings are set for new databases. -docker_verify_minimum_env() { - if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then - mysql_error <<-'EOF' - Database is uninitialized and password option is not specified - You need to specify one of the following as an environment variable: - - MYSQL_ROOT_PASSWORD - - MYSQL_ALLOW_EMPTY_PASSWORD - - MYSQL_RANDOM_ROOT_PASSWORD - EOF - fi - - # This will prevent the CREATE USER from failing (and thus exiting with a half-initialized database) - if [ "$MYSQL_USER" = 'root' ]; then - mysql_error <<-'EOF' - MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user - Remove MYSQL_USER="root" and use one of the following to control the root user password: - - MYSQL_ROOT_PASSWORD - - MYSQL_ALLOW_EMPTY_PASSWORD - - MYSQL_RANDOM_ROOT_PASSWORD - EOF - fi - - # warn when missing one of MYSQL_USER or MYSQL_PASSWORD - if [ -n "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then - mysql_warn 'MYSQL_USER specified, but missing MYSQL_PASSWORD; MYSQL_USER will not be created' - elif [ -z "$MYSQL_USER" ] && [ -n "$MYSQL_PASSWORD" ]; then - mysql_warn 'MYSQL_PASSWORD specified, but missing MYSQL_USER; MYSQL_PASSWORD will be ignored' - fi -} - -# creates folders for the database -# also ensures permission for user mysql of run as root -docker_create_db_directories() { - local user; user="$(id -u)" - - local -A dirs=( ["$DATADIR"]=1 ) - local dir - dir="$(dirname "$SOCKET")" - dirs["$dir"]=1 - - # "datadir" and "socket" are already handled above (since they were already queried previously) - local conf - for conf in \ - general-log-file \ - keyring_file_data \ - pid-file \ - secure-file-priv \ - slow-query-log-file \ - ; do - dir="$(mysql_get_config "$conf" "$@")" - - # skip empty values - if [ -z "$dir" ] || [ "$dir" = 'NULL' ]; then - continue - fi - case "$conf" in - secure-file-priv) - # already points at a directory - ;; - *) - # other config options point at a file, but we need the directory - dir="$(dirname "$dir")" - ;; - esac - - dirs["$dir"]=1 - done - - mkdir -p "${!dirs[@]}" - - if [ "$user" = "0" ]; then - # this will cause less disk access than `chown -R` - find "${!dirs[@]}" \! -user mysql -exec chown --no-dereference mysql '{}' + - fi -} - -# initializes the database directory -docker_init_database_dir() { - mysql_note "Initializing database files" - "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1 - # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a) - mysql_note "Database files initialized" -} - -# Loads various settings that are used elsewhere in the script -# This should be called after mysql_check_config, but before any other functions -docker_setup_env() { - # Get config - declare -g DATADIR SOCKET - DATADIR="$(mysql_get_config 'datadir' "$@")" - SOCKET="$(mysql_get_config 'socket' "$@")" - - # Initialize values that might be stored in a file - file_env 'MYSQL_ROOT_HOST' '%' - file_env 'MYSQL_DATABASE' - file_env 'MYSQL_USER' - file_env 'MYSQL_PASSWORD' - file_env 'MYSQL_ROOT_PASSWORD' - - declare -g DATABASE_ALREADY_EXISTS - if [ -d "$DATADIR/mysql" ]; then - DATABASE_ALREADY_EXISTS='true' - fi -} - -# Execute sql script, passed via stdin -# usage: docker_process_sql [--dont-use-mysql-root-password] [mysql-cli-args] -# ie: docker_process_sql --database=mydb <<<'INSERT ...' -# ie: docker_process_sql --dont-use-mysql-root-password --database=mydb /dev/null - - docker_init_database_dir "$@" - - mysql_note "Starting temporary server" - docker_temp_server_start "$@" - mysql_note "Temporary server started." - - mysql_socket_fix - docker_setup_db - docker_process_init_files /docker-entrypoint-initdb.d/* - - mysql_expire_root_user - - mysql_note "Stopping temporary server" - docker_temp_server_stop - mysql_note "Temporary server stopped" - - echo - mysql_note "MySQL init process done. Ready for start up." - echo - else - mysql_socket_fix - fi - fi - exec "$@" -} - -# If we are sourced from elsewhere, don't perform any further actions -if ! _is_sourced; then - _main "$@" -fi diff --git a/versions.json b/versions.json index 00b95004c..24893afba 100644 --- a/versions.json +++ b/versions.json @@ -46,28 +46,5 @@ "version": "8.4.9-1.el9" }, "version": "8.4.9" - }, - "8.0": { - "version": "8.0.46", - "debian": { - "architectures": [ - "amd64" - ], - "suite": "bookworm", - "version": "8.0.46-1debian12" - }, - "oracle": { - "architectures": [ - "amd64", - "arm64v8" - ], - "repo": "https://repo.mysql.com/yum/mysql-8.0-community/docker/el/9", - "version": "8.0.46-1.el9", - "variant": "9-slim" - }, - "mysql-shell": { - "repo": "https://repo.mysql.com/yum/mysql-tools-community/el/9", - "version": "8.0.46-1.el9" - } } } From 6ea5fc5a1d16f8290e74f1b013490cf14a6cedbf Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Wed, 22 Apr 2026 09:00:49 +0200 Subject: [PATCH 279/285] Update templates to remove 8.0 related pieces --- 8.4/docker-entrypoint.sh | 3 +- 9.7/docker-entrypoint.sh | 3 +- Dockerfile.debian | 96 --------------------------------- Dockerfile.oracle | 3 -- docker-entrypoint.sh | 3 +- innovation/docker-entrypoint.sh | 3 +- versions.sh | 39 +------------- 7 files changed, 5 insertions(+), 145 deletions(-) delete mode 100644 Dockerfile.debian diff --git a/8.4/docker-entrypoint.sh b/8.4/docker-entrypoint.sh index 0927b5ff8..884774a91 100755 --- a/8.4/docker-entrypoint.sh +++ b/8.4/docker-entrypoint.sh @@ -214,8 +214,7 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1 - # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a) + "$@" --initialize-insecure --default-time-zone=SYSTEM mysql_note "Database files initialized" } diff --git a/9.7/docker-entrypoint.sh b/9.7/docker-entrypoint.sh index 0927b5ff8..884774a91 100755 --- a/9.7/docker-entrypoint.sh +++ b/9.7/docker-entrypoint.sh @@ -214,8 +214,7 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1 - # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a) + "$@" --initialize-insecure --default-time-zone=SYSTEM mysql_note "Database files initialized" } diff --git a/Dockerfile.debian b/Dockerfile.debian deleted file mode 100644 index 0db1ae04d..000000000 --- a/Dockerfile.debian +++ /dev/null @@ -1,96 +0,0 @@ -FROM debian:{{ .debian.suite }}-slim - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN groupadd -r mysql && useradd -r -g mysql mysql - -RUN apt-get update && apt-get install -y --no-install-recommends gnupg && rm -rf /var/lib/apt/lists/* - -# add gosu for easy step-down from root -# https://github.com/tianon/gosu/releases -ENV GOSU_VERSION 1.19 -RUN set -eux; \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends ca-certificates wget; \ - rm -rf /var/lib/apt/lists/*; \ - dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ - wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ - wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ - gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - chmod +x /usr/local/bin/gosu; \ - gosu --version; \ - gosu nobody true - -RUN mkdir /docker-entrypoint-initdb.d - -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - bzip2 \ - openssl \ -# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db: -# File::Basename -# File::Copy -# Sys::Hostname -# Data::Dumper - perl \ - xz-utils \ - zstd \ - ; \ - rm -rf /var/lib/apt/lists/* - -RUN set -eux; \ -# pub rsa4096 2023-10-23 [SC] [expires: 2027-10-23] -# BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C -# uid [ unknown] MySQL Release Engineering -# sub rsa4096 2023-10-23 [E] [expires: 2027-10-23] - key='BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C'; \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ - mkdir -p /etc/apt/keyrings; \ - gpg --batch --export "$key" > /etc/apt/keyrings/mysql.gpg; \ - gpgconf --kill all; \ - rm -rf "$GNUPGHOME" - -ENV MYSQL_MAJOR {{ env.version }} -ENV MYSQL_VERSION {{ .debian.version }} - -RUN echo 'deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/apt/debian/ {{ .debian.suite }} mysql-{{ env.version }}' > /etc/apt/sources.list.d/mysql.list - -# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql) -# also, we set debconf keys to make APT a little quieter -RUN { \ - echo mysql-community-server mysql-community-server/data-dir select ''; \ - echo mysql-community-server mysql-community-server/root-pass password ''; \ - echo mysql-community-server mysql-community-server/re-root-pass password ''; \ - echo mysql-community-server mysql-community-server/remove-test-db select false; \ - } | debconf-set-selections \ - && apt-get update \ - && apt-get install -y \ - mysql-community-client="${MYSQL_VERSION}" \ - mysql-community-server-core="${MYSQL_VERSION}" \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \ - && chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \ -# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime - && chmod 1777 /var/run/mysqld /var/lib/mysql - -VOLUME /var/lib/mysql - -# Config files -COPY config/ /etc/mysql/ -COPY docker-entrypoint.sh /usr/local/bin/ -{{ if env.version == "8.0" then ( -}} -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -{{ ) else "" end -}} -ENTRYPOINT ["docker-entrypoint.sh"] - -EXPOSE 3306 33060 -CMD ["mysqld"] diff --git a/Dockerfile.oracle b/Dockerfile.oracle index 01d9ba7fe..8e6b7ab18 100644 --- a/Dockerfile.oracle +++ b/Dockerfile.oracle @@ -132,9 +132,6 @@ RUN set -eux; \ VOLUME /var/lib/mysql COPY docker-entrypoint.sh /usr/local/bin/ -{{ if env.version == "8.0" then ( -}} -RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat -{{ ) else "" end -}} ENTRYPOINT ["docker-entrypoint.sh"] EXPOSE 3306 33060 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 0927b5ff8..884774a91 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -214,8 +214,7 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1 - # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a) + "$@" --initialize-insecure --default-time-zone=SYSTEM mysql_note "Database files initialized" } diff --git a/innovation/docker-entrypoint.sh b/innovation/docker-entrypoint.sh index 0927b5ff8..884774a91 100755 --- a/innovation/docker-entrypoint.sh +++ b/innovation/docker-entrypoint.sh @@ -214,8 +214,7 @@ docker_create_db_directories() { # initializes the database directory docker_init_database_dir() { mysql_note "Initializing database files" - "$@" --initialize-insecure --default-time-zone=SYSTEM --autocommit=1 - # explicitly enable autocommit to combat https://bugs.mysql.com/bug.php?id=110535 (TODO remove this when 8.0 is EOL; see https://github.com/mysql/mysql-server/commit/7dbf4f80ed15f3c925cfb2b834142f23a2de719a) + "$@" --initialize-insecure --default-time-zone=SYSTEM mysql_note "Database files initialized" } diff --git a/versions.sh b/versions.sh index b3632f69f..b41ebe33b 100755 --- a/versions.sh +++ b/versions.sh @@ -66,48 +66,11 @@ for version in "${versions[@]}"; do doc='{}' - if [ "$version" = '8.0' ]; then - debianSuite="${debianSuites[$version]:-$defaultDebianSuite}" - debianVersion="$( - curl -fsSL "https://repo.mysql.com/apt/debian/dists/$debianSuite/mysql-$version/binary-amd64/Packages.gz" \ - | gunzip \ - | awk -F ': ' ' - $1 == "Package" { - pkg = $2 - next - } - pkg == "mysql-server" && $1 == "Version" { - print $2 - } - ' - )" - - # example 8.0.22-1debian10 => 8.0.22 - baseVersion="${debianVersion%-*}" - - export baseVersion debianSuite debianVersion - doc="$( - jq <<<"$doc" -c ' - . += { - version: env.baseVersion, - debian: { - architectures: [ "amd64" ], - suite: env.debianSuite, - version: env.debianVersion, - }, - } - ' - )" - fi - oracleVariant="${oracleVariants[$version]:-$defaultOracleVariant}" oracleVersion="${oracleVariant%%-*}" # "7", etc rpmRepo="https://repo.mysql.com/yum/mysql-$version-community/docker/el/$oracleVersion" - case "$version" in - 8.0) toolsRepo="https://repo.mysql.com/yum/mysql-tools-community/el/$oracleVersion" ;; - *) toolsRepo="https://repo.mysql.com/yum/mysql-tools-$version-community/el/$oracleVersion" ;; - esac + toolsRepo="https://repo.mysql.com/yum/mysql-tools-$version-community/el/$oracleVersion" export rpmRepo toolsRepo rpmVersion= From f59266f3ec6f1ddfc66d1db613430d9dcc52419b Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Wed, 22 Apr 2026 09:02:23 +0200 Subject: [PATCH 280/285] Update some 8.0 references to 9.7 (latest lts) --- 8.4/Dockerfile.oracle | 2 +- 9.7/Dockerfile.oracle | 2 +- Dockerfile.oracle | 2 +- innovation/Dockerfile.oracle | 2 +- versions.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index 0ea34975d..7ba6ae8b8 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -44,7 +44,7 @@ RUN set -eux; \ microdnf clean all RUN set -eux; \ -# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html +# https://dev.mysql.com/doc/refman/9.7/en/checking-gpg-signature.html # pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] # BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C # uid [ unknown] MySQL Release Engineering diff --git a/9.7/Dockerfile.oracle b/9.7/Dockerfile.oracle index a7535e806..11037dfd0 100644 --- a/9.7/Dockerfile.oracle +++ b/9.7/Dockerfile.oracle @@ -44,7 +44,7 @@ RUN set -eux; \ microdnf clean all RUN set -eux; \ -# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html +# https://dev.mysql.com/doc/refman/9.7/en/checking-gpg-signature.html # pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] # BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C # uid [ unknown] MySQL Release Engineering diff --git a/Dockerfile.oracle b/Dockerfile.oracle index 8e6b7ab18..0abcd21f5 100644 --- a/Dockerfile.oracle +++ b/Dockerfile.oracle @@ -59,7 +59,7 @@ RUN set -eux; \ {{ dnf }} clean all RUN set -eux; \ -# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html +# https://dev.mysql.com/doc/refman/9.7/en/checking-gpg-signature.html # pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] # BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C # uid [ unknown] MySQL Release Engineering diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index 39f4c11e0..dbf51aeab 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -44,7 +44,7 @@ RUN set -eux; \ microdnf clean all RUN set -eux; \ -# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html +# https://dev.mysql.com/doc/refman/9.7/en/checking-gpg-signature.html # pub rsa4096 2023-10-23 [SC] [expires: 2025-10-22] # BCA4 3417 C3B4 85DD 128E C6D4 B7B3 B788 A8D3 785C # uid [ unknown] MySQL Release Engineering diff --git a/versions.sh b/versions.sh index b41ebe33b..0dfee05aa 100755 --- a/versions.sh +++ b/versions.sh @@ -11,7 +11,7 @@ declare -A oracleVariants=( #[innovation]='8-slim' ) -# https://repo.mysql.com/yum/mysql-8.0-community/docker/ +# https://repo.mysql.com/yum/mysql-9.7-community/docker/ declare -A bashbrewArchToRpmArch=( [amd64]='x86_64' [arm64v8]='aarch64' From 99f090f89830dbd679771884e723c0f74bec0b29 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 16 Jun 2026 14:15:11 -0700 Subject: [PATCH 281/285] Update 8.4 to 8.4.10, oracle 8.4.10-1.el9, mysql-shell 8.4.10-1.el9 --- 8.4/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index 7ba6ae8b8..b827298a8 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.9-1.el9 +ENV MYSQL_VERSION 8.4.10-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 8.4.9-1.el9 +ENV MYSQL_SHELL_VERSION 8.4.10-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 24893afba..c8a6e45fe 100644 --- a/versions.json +++ b/versions.json @@ -38,13 +38,13 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.9-1.el9", + "version": "8.4.10-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", - "version": "8.4.9-1.el9" + "version": "8.4.10-1.el9" }, - "version": "8.4.9" + "version": "8.4.10" } } From 7f30fdb0738041fc5125e8218e393e0a891243e9 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Tue, 16 Jun 2026 14:20:25 -0700 Subject: [PATCH 282/285] Update 9.7 to 9.7.1, oracle 9.7.1-1.el9, mysql-shell 9.7.1-1.el9 --- 9.7/Dockerfile.oracle | 4 ++-- versions.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/9.7/Dockerfile.oracle b/9.7/Dockerfile.oracle index 11037dfd0..60849abb1 100644 --- a/9.7/Dockerfile.oracle +++ b/9.7/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 9.7 -ENV MYSQL_VERSION 9.7.0-1.el9 +ENV MYSQL_VERSION 9.7.1-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 9.7.0-1.el9 +ENV MYSQL_SHELL_VERSION 9.7.1-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index c8a6e45fe..a08f96c7f 100644 --- a/versions.json +++ b/versions.json @@ -6,14 +6,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-9.7-community/docker/el/9", - "version": "9.7.0-1.el9", + "version": "9.7.1-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-9.7-community/el/9", - "version": "9.7.0-1.el9" + "version": "9.7.1-1.el9" }, - "version": "9.7.0" + "version": "9.7.1" }, "innovation": { "oracle": { From 01f90d87012e46cd174073bba02d64e9fc693ed3 Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 27 Jul 2026 14:15:10 -0700 Subject: [PATCH 283/285] Update 8.4 to 8.4.11, oracle 8.4.11-1.el9, mysql-shell 8.4.10-1.el9 --- 8.4/Dockerfile.oracle | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/8.4/Dockerfile.oracle b/8.4/Dockerfile.oracle index b827298a8..d484d5718 100644 --- a/8.4/Dockerfile.oracle +++ b/8.4/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 8.4 -ENV MYSQL_VERSION 8.4.10-1.el9 +ENV MYSQL_VERSION 8.4.11-1.el9 RUN set -eu; \ { \ diff --git a/versions.json b/versions.json index a08f96c7f..de547bcf2 100644 --- a/versions.json +++ b/versions.json @@ -38,13 +38,13 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-8.4-community/docker/el/9", - "version": "8.4.10-1.el9", + "version": "8.4.11-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-8.4-community/el/9", "version": "8.4.10-1.el9" }, - "version": "8.4.10" + "version": "8.4.11" } } From 55e1d05e12ac954be18a3114d7c177ad957e435b Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 27 Jul 2026 14:21:27 -0700 Subject: [PATCH 284/285] Update 9.7 to 9.7.2, oracle 9.7.2-1.el9, mysql-shell 9.7.1-1.el9 --- 9.7/Dockerfile.oracle | 2 +- versions.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/9.7/Dockerfile.oracle b/9.7/Dockerfile.oracle index 60849abb1..73b2784fb 100644 --- a/9.7/Dockerfile.oracle +++ b/9.7/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR 9.7 -ENV MYSQL_VERSION 9.7.1-1.el9 +ENV MYSQL_VERSION 9.7.2-1.el9 RUN set -eu; \ { \ diff --git a/versions.json b/versions.json index de547bcf2..1b2fb96b1 100644 --- a/versions.json +++ b/versions.json @@ -6,14 +6,14 @@ "arm64v8" ], "repo": "https://repo.mysql.com/yum/mysql-9.7-community/docker/el/9", - "version": "9.7.1-1.el9", + "version": "9.7.2-1.el9", "variant": "9-slim" }, "mysql-shell": { "repo": "https://repo.mysql.com/yum/mysql-tools-9.7-community/el/9", "version": "9.7.1-1.el9" }, - "version": "9.7.1" + "version": "9.7.2" }, "innovation": { "oracle": { From 288e46ff450920468d5a1fcb618d359068704c3d Mon Sep 17 00:00:00 2001 From: Docker Library Bot Date: Mon, 27 Jul 2026 14:26:16 -0700 Subject: [PATCH 285/285] Update innovation to 26.7.0, oracle 26.7.0-1.el9, mysql-shell 26.7.0-1.el9 --- innovation/Dockerfile.oracle | 4 ++-- versions.json | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/innovation/Dockerfile.oracle b/innovation/Dockerfile.oracle index dbf51aeab..220fbf8ff 100644 --- a/innovation/Dockerfile.oracle +++ b/innovation/Dockerfile.oracle @@ -56,7 +56,7 @@ RUN set -eux; \ rm -rf "$GNUPGHOME" ENV MYSQL_MAJOR innovation -ENV MYSQL_VERSION 9.6.0-1.el9 +ENV MYSQL_VERSION 26.7.0-1.el9 RUN set -eu; \ { \ @@ -107,7 +107,7 @@ RUN set -eu; \ # https://github.com/docker-library/mysql/pull/680#issuecomment-825930524 echo 'module_hotfixes=true'; \ } | tee /etc/yum.repos.d/mysql-community-tools.repo -ENV MYSQL_SHELL_VERSION 9.6.0-1.el9 +ENV MYSQL_SHELL_VERSION 26.7.0-1.el9 RUN set -eux; \ microdnf install -y "mysql-shell-$MYSQL_SHELL_VERSION"; \ microdnf clean all; \ diff --git a/versions.json b/versions.json index 1b2fb96b1..881e94f76 100644 --- a/versions.json +++ b/versions.json @@ -1,35 +1,35 @@ { - "9.7": { + "innovation": { "oracle": { "architectures": [ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-9.7-community/docker/el/9", - "version": "9.7.2-1.el9", + "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9", + "version": "26.7.0-1.el9", "variant": "9-slim" }, "mysql-shell": { - "repo": "https://repo.mysql.com/yum/mysql-tools-9.7-community/el/9", - "version": "9.7.1-1.el9" + "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", + "version": "26.7.0-1.el9" }, - "version": "9.7.2" + "version": "26.7.0" }, - "innovation": { + "9.7": { "oracle": { "architectures": [ "amd64", "arm64v8" ], - "repo": "https://repo.mysql.com/yum/mysql-innovation-community/docker/el/9", - "version": "9.6.0-1.el9", + "repo": "https://repo.mysql.com/yum/mysql-9.7-community/docker/el/9", + "version": "9.7.2-1.el9", "variant": "9-slim" }, "mysql-shell": { - "repo": "https://repo.mysql.com/yum/mysql-tools-innovation-community/el/9", - "version": "9.6.0-1.el9" + "repo": "https://repo.mysql.com/yum/mysql-tools-9.7-community/el/9", + "version": "9.7.1-1.el9" }, - "version": "9.6.0" + "version": "9.7.2" }, "8.4": { "oracle": {