Closed ngan closed 8 months ago
We have no plans to add variant images that just install different mysql-community-*
packages. I'd suggest building your own by extending the current image:
FROM mysql:8.0-debian
RUN set -eux; \
apt-get update; \
apt-get install -y mysql-community-test="${MYSQL_VERSION}"; \
rm -rf /var/lib/apt/lists/*
We try to keep the images as minimal as we can and mysql-community-test
and its dependencies is not small:
The following NEW packages will be installed:
libcommon-sense-perl (3.75-3)
libjson-perl (4.10000-1)
libjson-xs-perl (4.030-2+b1)
libmysqlclient-dev (8.0.36-1debian12)
libmysqlclient21 (8.0.36-1debian12)
libtypes-serialiser-perl (1.01-1)
mysql-client (8.0.36-1debian12)
mysql-community-server (8.0.36-1debian12)
mysql-community-test (8.0.36-1debian12)
psmisc (23.6-1)
0 upgraded, 10 newly installed, 0 to remove and 8 not upgraded.
Need to get 360 MB of archives.
After this operation, 794 MB of additional disk space will be used.
Thanks @yosifkit, I have some follow up questions:
The pgp key is not available. I'm assuming I have to do this again in my image, is that right?
# Install key for MySQL APT repository.
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; \
I'm running into this prompt during build, any way to bypass this?
I got the same gpg key error when using mysql:8-debian
, but then checked and saw that that tag isn't updated anymore. If I use mysql:8.0-debian
, it works fine.
The configuration should only stop the install if apt-get install
was run interactively. It seems to work fine in a docker build
:
$ DOCKER_BUILDKIT=0 docker build - <<'EOF'
FROM mysql:8.0-debian
RUN set -eux; apt-get update; apt-get install -y mysql-community-test="${MYSQL_VERSION}"; rm -rf /var/lib/apt/lists/*
EOF
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
BuildKit is currently disabled; enable it by removing the DOCKER_BUILDKIT=0
environment-variable.
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM mysql:8.0-debian
---> b1c0bd217d59
Step 2/2 : RUN set -eux; apt-get update; apt-get install -y mysql-community-test="${MYSQL_VERSION}"; rm -rf /var/lib/apt/lists/*
---> Running in 0799d262ac63
+ apt-get update
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://repo.mysql.com/apt/debian bookworm InRelease [17.9 kB]
Get:3 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:4 http://repo.mysql.com/apt/debian bookworm/mysql-8.0 amd64 Packages [12.6 kB]
Get:5 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:6 http://deb.debian.org/debian bookworm/main amd64 Packages [8786 kB]
Get:7 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [12.7 kB]
Get:8 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [150 kB]
Fetched 9234 kB in 1s (8241 kB/s)
Reading package lists...
+ apt-get install -y mysql-community-test=8.0.36-1debian12
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
libcommon-sense-perl libjson-perl libjson-xs-perl libmysqlclient-dev
libmysqlclient21 libtypes-serialiser-perl mysql-client
mysql-community-server psmisc
The following NEW packages will be installed:
libcommon-sense-perl libjson-perl libjson-xs-perl libmysqlclient-dev
libmysqlclient21 libtypes-serialiser-perl mysql-client
mysql-community-server mysql-community-test psmisc
0 upgraded, 10 newly installed, 0 to remove and 8 not upgraded.
Need to get 360 MB of archives.
After this operation, 794 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 psmisc amd64 23.6-1 [259 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 libcommon-sense-perl amd64 3.75-3 [23.0 kB]
Get:3 http://deb.debian.org/debian bookworm/main amd64 libjson-perl all 4.10000-1 [87.5 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 libtypes-serialiser-perl all 1.01-1 [12.2 kB]
Get:5 http://deb.debian.org/debian bookworm/main amd64 libjson-xs-perl amd64 4.030-2+b1 [92.1 kB]
Get:6 http://repo.mysql.com/apt/debian bookworm/mysql-8.0 amd64 mysql-client amd64 8.0.36-1debian12 [66.2 kB]
Get:7 http://repo.mysql.com/apt/debian bookworm/mysql-8.0 amd64 mysql-community-server amd64 8.0.36-1debian12 [76.5 kB]
Get:8 http://repo.mysql.com/apt/debian bookworm/mysql-8.0 amd64 libmysqlclient21 amd64 8.0.36-1debian12 [1362 kB]
Get:9 http://repo.mysql.com/apt/debian bookworm/mysql-8.0 amd64 libmysqlclient-dev amd64 8.0.36-1debian12 [1679 kB]
Get:10 http://repo.mysql.com/apt/debian bookworm/mysql-8.0 amd64 mysql-community-test amd64 8.0.36-1debian12 [357 MB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 360 MB in 12s (29.2 MB/s)
Selecting previously unselected package mysql-client.
(Reading database ... 9374 files and directories currently installed.)
Preparing to unpack .../0-mysql-client_8.0.36-1debian12_amd64.deb ...
Unpacking mysql-client (8.0.36-1debian12) ...
Selecting previously unselected package psmisc.
Preparing to unpack .../1-psmisc_23.6-1_amd64.deb ...
Unpacking psmisc (23.6-1) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack .../2-mysql-community-server_8.0.36-1debian12_amd64.deb ...
Unpacking mysql-community-server (8.0.36-1debian12) ...
Selecting previously unselected package libcommon-sense-perl:amd64.
Preparing to unpack .../3-libcommon-sense-perl_3.75-3_amd64.deb ...
Unpacking libcommon-sense-perl:amd64 (3.75-3) ...
Selecting previously unselected package libjson-perl.
Preparing to unpack .../4-libjson-perl_4.10000-1_all.deb ...
Unpacking libjson-perl (4.10000-1) ...
Selecting previously unselected package libtypes-serialiser-perl.
Preparing to unpack .../5-libtypes-serialiser-perl_1.01-1_all.deb ...
Unpacking libtypes-serialiser-perl (1.01-1) ...
Selecting previously unselected package libjson-xs-perl.
Preparing to unpack .../6-libjson-xs-perl_4.030-2+b1_amd64.deb ...
Unpacking libjson-xs-perl (4.030-2+b1) ...
Selecting previously unselected package libmysqlclient21:amd64.
Preparing to unpack .../7-libmysqlclient21_8.0.36-1debian12_amd64.deb ...
Unpacking libmysqlclient21:amd64 (8.0.36-1debian12) ...
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack .../8-libmysqlclient-dev_8.0.36-1debian12_amd64.deb ...
Unpacking libmysqlclient-dev (8.0.36-1debian12) ...
Selecting previously unselected package mysql-community-test.
Preparing to unpack .../9-mysql-community-test_8.0.36-1debian12_amd64.deb ...
Unpacking mysql-community-test (8.0.36-1debian12) ...
Setting up libmysqlclient21:amd64 (8.0.36-1debian12) ...
Setting up mysql-client (8.0.36-1debian12) ...
Setting up psmisc (23.6-1) ...
Setting up libcommon-sense-perl:amd64 (3.75-3) ...
Setting up mysql-community-server (8.0.36-1debian12) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
Configuring mysql-community-server
----------------------------------
MySQL 8 uses a new authentication based on improved SHA256-based password
methods. It is recommended that all new MySQL Server installations use this
method going forward. This new authentication plugin requires new versions of
connectors and clients, with support for this new authentication method
(caching_sha2_password). Currently MySQL 8 Connectors and community drivers
built with libmysqlclient21 support this new method. Clients built with older
versions of libmysqlclient may not be able to connect to the new server.
To retain compatibility with older client software, the default authentication
plugin can be set to the legacy value (mysql_native_password) This should only
be done if required third-party software has not been updated to work with the
new authentication method. The change will be written to the file
/etc/mysql/mysql.conf.d/default-auth-override.cnf
After installation, the default can be changed by setting the
default_authentication_plugin server setting.
1. Use Strong Password Encryption (RECOMMENDED)
2. Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)
Select default authentication plugin
Use of uninitialized value $_[1] in join or string at /usr/share/perl5/Debconf/DbDriver/Stack.pm line 111.
WARNING: /etc/mysql/my.cnf moved to /etc/mysql/my.cnf.bak
Please use etc/mysql/mysql.conf.d for any custom configuration settings
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Use of uninitialized value $val in substitution (s///) at /usr/share/perl5/Debconf/Format/822.pm line 83, <GEN6> line 6.
Use of uninitialized value $val in concatenation (.) or string at /usr/share/perl5/Debconf/Format/822.pm line 84, <GEN6> line 6.
Setting up libtypes-serialiser-perl (1.01-1) ...
Setting up libjson-perl (4.10000-1) ...
Setting up libmysqlclient-dev (8.0.36-1debian12) ...
Setting up libjson-xs-perl (4.030-2+b1) ...
Setting up mysql-community-test (8.0.36-1debian12) ...
Processing triggers for libc-bin (2.36-9+deb12u4) ...
+ rm -rf /var/lib/apt/lists/auxfiles /var/lib/apt/lists/deb.debian.org_debian-security_dists_bookworm-security_InRelease /var/lib/apt/lists/deb.debian.org_debian-security_dists_bookworm-security_main_binary-amd64_Packages.lz4 /var/lib/apt/lists/deb.debian.org_debian_dists_bookworm-updates_InRelease /var/lib/apt/lists/deb.debian.org_debian_dists_bookworm-updates_main_binary-amd64_Packages.lz4 /var/lib/apt/lists/deb.debian.org_debian_dists_bookworm_InRelease /var/lib/apt/lists/deb.debian.org_debian_dists_bookworm_main_binary-amd64_Packages.lz4 /var/lib/apt/lists/lock /var/lib/apt/lists/partial /var/lib/apt/lists/repo.mysql.com_apt_debian_dists_bookworm_InRelease /var/lib/apt/lists/repo.mysql.com_apt_debian_dists_bookworm_mysql-8.0_binary-amd64_Packages.lz4
---> Removed intermediate container 0799d262ac63
---> 2ebbef7f3f0d
Successfully built 2ebbef7f3f0d
Hm, I’m definitely building it noninteractively and it’s still getting stuck. I noticed you disabled Buildkit. That might be the difference? I’ll test it out, but was there a reason you did that?
Actually, I think I got it to work using:
ARG DEBIAN_FRONTEND=noninteractive
Thanks @yosifkit!
It looks I'm having the key issue for MySQL 5.7 (5.7-debian
). Are you guys not pushing to that tag anymore?
Ok, going back to 8.0. I was able to build the image successfully. However, when I run it, it's just stuck here:
$ docker run --platform linux/x86_64 -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_DATABASE=test -e MYSQL_HOST=db.local -v ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d --publish 6603:3306 sha256:10bc373754f72c21dc0473c6d72dba876fe243626aabfd0a9d73a27b9669d22d
2024-04-06 00:21:46+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.36-1debian12 started.
2024-04-06 00:21:48+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2024-04-06 00:21:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.36-1debian12 started.
@yosifkit just curious if you were able to run the image you built?
As a side note, I was able to build 5.7 and it ran successfully.
Closing the loop on this: the problem was that when I installed the mysql-community-test
package, it naturally added to the datadir (/var/lib/mysql/). The entrypoint script looks for whether that directory exists and only initializes things if the directory doesn’t exist. This is why the base/original image rm -rf
the datadir.
I decided to not do the same thing because I’m wary of other things that might break in the future. Instead, I’m using docker multistage build to install the test package in one layer and copy the auth plugins to the final layer with the non-test package (ie the original docker image).
Thanks for the help, everyone.
Hi, we're using this mysql docker image to test Trilogy:
We were interested in using the
auth_test_plugin.so
plugin to store a user with cleartext password. This allows us to test theenable_cleartext_plugin
implementation in our client. Using this plugin would result in the server sending back a cleartext auth switch, which is what we're looking to do. This is so that our client can connect to RDS via IAM credentials.Would y'all be open to (additionally) building and tagging images using
mysql-community-test
(instead ofmysql-community-server
)? This distribution comes with a bunch of test plugins (egauth_test_plugin.so
) whereas the one we're using now doesn't.For reference, here are the plugins that come with
-test
:The
-server
installation only comes with: