docker-library / mysql

Docker Official Image packaging for MySQL Community Server
https://dev.mysql.com/
GNU General Public License v2.0
2.42k stars 2.18k forks source link

Add mysql test distribution variant/tag #1040

Closed ngan closed 2 months ago

ngan commented 2 months ago

Hi, we're using this mysql docker image to test Trilogy:

Trilogy is a client library for MySQL-compatible database servers, designed for performance, flexibility, and ease of embedding.

We were interested in using the auth_test_plugin.so plugin to store a user with cleartext password. This allows us to test the enable_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 of mysql-community-server)? This distribution comes with a bunch of test plugins (eg auth_test_plugin.so) whereas the one we're using now doesn't.

For reference, here are the plugins that come with -test:

-rw-r--r-- 1 root root   29864 Dec 12 18:42 adt_null.so
-rw-r--r-- 1 root root   14976 Dec 12 18:42 auth.so
-rw-r--r-- 1 root root   14656 Dec 12 18:42 auth_socket.so
-rw-r--r-- 1 root root   15072 Dec 12 18:42 auth_test_plugin.so
-rw-r--r-- 1 root root   31584 Dec 12 18:42 authentication_fido_client.so
-rw-r--r-- 1 root root 6676960 Dec 12 18:42 authentication_kerberos_client.so
-rw-r--r-- 1 root root 6569264 Dec 12 18:42 authentication_ldap_sasl_client.so
-rw-r--r-- 1 root root 6656592 Dec 12 18:42 authentication_oci_client.so
-rw-r--r-- 1 root root   19096 Dec 12 18:42 component_audit_api_message_emit.so
-rw-r--r-- 1 root root   14344 Dec 12 18:42 component_example_component1.so
-rw-r--r-- 1 root root   14328 Dec 12 18:42 component_example_component2.so
-rw-r--r-- 1 root root   14696 Dec 12 18:42 component_example_component3.so
-rw-r--r-- 1 root root 1839720 Dec 12 18:42 component_keyring_file.so
-rw-r--r-- 1 root root   27224 Dec 12 18:42 component_log_filter_dragnet.so
-rw-r--r-- 1 root root   35272 Dec 12 18:42 component_log_sink_json.so
-rw-r--r-- 1 root root   18928 Dec 12 18:42 component_log_sink_syseventlog.so
-rw-r--r-- 1 root root   31184 Dec 12 18:42 component_log_sink_test.so
-rw-r--r-- 1 root root   39624 Dec 12 18:42 component_mysqlbackup.so
-rw-r--r-- 1 root root   14664 Dec 12 18:42 component_mysqlx_global_reset.so
-rw-r--r-- 1 root root   15136 Dec 12 18:42 component_pfs_example.so
-rw-r--r-- 1 root root   21848 Dec 12 18:42 component_pfs_example_component_population.so
-rw-r--r-- 1 root root   14656 Dec 12 18:42 component_query_attributes.so
-rw-r--r-- 1 root root   39648 Dec 12 18:42 component_reference_cache.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_test_audit_api_message.so
-rw-r--r-- 1 root root   14216 Dec 12 18:42 component_test_backup_lock_service.so
-rw-r--r-- 1 root root   14200 Dec 12 18:42 component_test_component_deinit.so
-rw-r--r-- 1 root root   14584 Dec 12 18:42 component_test_host_application_signal.so
-rw-r--r-- 1 root root   18888 Dec 12 18:42 component_test_mysql_command_services.so
-rw-r--r-- 1 root root   14528 Dec 12 18:42 component_test_mysql_current_thread_reader.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_test_mysql_runtime_error.so
-rw-r--r-- 1 root root   18808 Dec 12 18:42 component_test_mysql_system_variable_set.so
-rw-r--r-- 1 root root   18792 Dec 12 18:42 component_test_mysql_thd_store_service.so
-rw-r--r-- 1 root root   35352 Dec 12 18:42 component_test_pfs_notification.so
-rw-r--r-- 1 root root   27176 Dec 12 18:42 component_test_pfs_resource_group.so
-rw-r--r-- 1 root root   14584 Dec 12 18:42 component_test_sensitive_system_variables.so
-rw-r--r-- 1 root root   39880 Dec 12 18:42 component_test_server_telemetry_traces.so
-rw-r--r-- 1 root root   14752 Dec 12 18:42 component_test_status_var_reader.so
-rw-r--r-- 1 root root   15288 Dec 12 18:42 component_test_status_var_service.so
-rw-r--r-- 1 root root   14688 Dec 12 18:42 component_test_status_var_service_int.so
-rw-r--r-- 1 root root   14752 Dec 12 18:42 component_test_status_var_service_reg_only.so
-rw-r--r-- 1 root root   14616 Dec 12 18:42 component_test_status_var_service_str.so
-rw-r--r-- 1 root root   14752 Dec 12 18:42 component_test_status_var_service_unreg_only.so
-rw-r--r-- 1 root root   18704 Dec 12 18:42 component_test_string_service.so
-rw-r--r-- 1 root root   14608 Dec 12 18:42 component_test_string_service_charset.so
-rw-r--r-- 1 root root   14640 Dec 12 18:42 component_test_string_service_long.so
-rw-r--r-- 1 root root   18696 Dec 12 18:42 component_test_sys_var_service.so
-rw-r--r-- 1 root root   14536 Dec 12 18:42 component_test_sys_var_service_int.so
-rw-r--r-- 1 root root   18696 Dec 12 18:42 component_test_sys_var_service_same.so
-rw-r--r-- 1 root root   14536 Dec 12 18:42 component_test_sys_var_service_str.so
-rw-r--r-- 1 root root   14488 Dec 12 18:42 component_test_system_variable_source.so
-rw-r--r-- 1 root root   27536 Dec 12 18:42 component_test_table_access.so
-rw-r--r-- 1 root root   14680 Dec 12 18:42 component_test_udf_registration.so
-rw-r--r-- 1 root root   31280 Dec 12 18:42 component_test_udf_services.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_udf_reg_3_func.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_udf_reg_avg_func.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_udf_reg_int_func.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_udf_reg_int_same_func.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_udf_reg_only_3_func.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_udf_reg_real_func.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_udf_unreg_3_func.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_udf_unreg_int_func.so
-rw-r--r-- 1 root root   14496 Dec 12 18:42 component_udf_unreg_real_func.so
-rw-r--r-- 1 root root   52424 Dec 12 18:42 component_validate_password.so
-rw-r--r-- 1 root root   14432 Dec 12 18:42 conflicting_variables.so
-rw-r--r-- 1 root root   57272 Dec 12 18:42 connection_control.so
-rw-r--r-- 1 root root    1360 Dec 12 18:09 daemon_example.ini
-rw-r--r-- 1 root root  160584 Dec 12 18:42 ddl_rewriter.so
-rw-r--r-- 1 root root 2862752 Dec 12 18:42 group_replication.so
-rw-r--r-- 1 root root   45264 Dec 12 18:42 ha_example.so
-rw-r--r-- 1 root root   55928 Dec 12 18:42 ha_mock.so
-rw-r--r-- 1 root root  101856 Dec 12 18:42 innodb_engine.so
-rw-r--r-- 1 root root  114736 Dec 12 18:42 keyring_file.so
-rw-r--r-- 1 root root   22944 Dec 12 18:42 keyring_udf.so
-rw-r--r-- 1 root root   14728 Dec 12 18:42 libdaemon_example.so
-rw-r--r-- 1 root root  230232 Dec 12 18:42 libmemcached.so
-rw-r--r-- 1 root root   27448 Dec 12 18:42 libpluginmecab.so
-rw-r--r-- 1 root root   14280 Dec 12 18:42 libtest_framework.so
-rw-r--r-- 1 root root   14896 Dec 12 18:42 libtest_services.so
-rw-r--r-- 1 root root   18968 Dec 12 18:42 libtest_services_threaded.so
-rw-r--r-- 1 root root   47824 Dec 12 18:42 libtest_session_attach.so
-rw-r--r-- 1 root root   27216 Dec 12 18:42 libtest_session_detach.so
-rw-r--r-- 1 root root   18952 Dec 12 18:42 libtest_session_in_thd.so
-rw-r--r-- 1 root root   43672 Dec 12 18:42 libtest_session_info.so
-rw-r--r-- 1 root root   35456 Dec 12 18:42 libtest_sql_2_sessions.so
-rw-r--r-- 1 root root   35408 Dec 12 18:42 libtest_sql_all_col_types.so
-rw-r--r-- 1 root root   35552 Dec 12 18:42 libtest_sql_cmds_1.so
-rw-r--r-- 1 root root   35392 Dec 12 18:42 libtest_sql_commit.so
-rw-r--r-- 1 root root   35424 Dec 12 18:42 libtest_sql_complex.so
-rw-r--r-- 1 root root   35536 Dec 12 18:42 libtest_sql_errors.so
-rw-r--r-- 1 root root   43600 Dec 12 18:42 libtest_sql_lock.so
-rw-r--r-- 1 root root   35392 Dec 12 18:42 libtest_sql_processlist.so
-rw-r--r-- 1 root root   35376 Dec 12 18:42 libtest_sql_replication.so
-rw-r--r-- 1 root root   31352 Dec 12 18:42 libtest_sql_reset_connection.so
-rw-r--r-- 1 root root   27288 Dec 12 18:42 libtest_sql_shutdown.so
-rw-r--r-- 1 root root   55888 Dec 12 18:42 libtest_sql_sleep_is_connected.so
-rw-r--r-- 1 root root   35424 Dec 12 18:42 libtest_sql_sqlmode.so
-rw-r--r-- 1 root root   72624 Dec 12 18:42 libtest_sql_stmt.so
-rw-r--r-- 1 root root   35424 Dec 12 18:42 libtest_sql_stored_procedures_functions.so
-rw-r--r-- 1 root root   35424 Dec 12 18:42 libtest_sql_views_triggers.so
-rw-r--r-- 1 root root   18920 Dec 12 18:42 libtest_x_sessions_deinit.so
-rw-r--r-- 1 root root   23064 Dec 12 18:42 libtest_x_sessions_init.so
-rw-r--r-- 1 root root   14104 Dec 12 18:42 locking_service.so
-rw-r--r-- 1 root root   15072 Dec 12 18:42 mypluglib.so
-rw-r--r-- 1 root root  156992 Dec 12 18:42 mysql_clone.so
-rw-r--r-- 1 root root   14360 Dec 12 18:42 mysql_no_login.so
-rw-r--r-- 1 root root   73328 Dec 12 18:42 pfs_example_plugin_employee.so
-rw-r--r-- 1 root root   14416 Dec 12 18:42 qa_auth_client.so
-rw-r--r-- 1 root root   14784 Dec 12 18:42 qa_auth_interface.so
-rw-r--r-- 1 root root   14624 Dec 12 18:42 qa_auth_server.so
-rw-r--r-- 1 root root   64592 Dec 12 18:42 replication_observers_example_plugin.so
-rw-r--r-- 1 root root   14728 Dec 12 18:42 rewrite_example.so
-rw-r--r-- 1 root root   65184 Dec 12 18:42 rewriter.so
-rw-r--r-- 1 root root   90512 Dec 12 18:42 semisync_master.so
-rw-r--r-- 1 root root   35744 Dec 12 18:42 semisync_replica.so
-rw-r--r-- 1 root root   35776 Dec 12 18:42 semisync_slave.so
-rw-r--r-- 1 root root   90480 Dec 12 18:42 semisync_source.so
-rw-r--r-- 1 root root   14856 Dec 12 18:42 test_security_context.so
-rw-r--r-- 1 root root   18816 Dec 12 18:42 test_services_command_services.so
-rw-r--r-- 1 root root   14712 Dec 12 18:42 test_services_host_application_signal.so
-rw-r--r-- 1 root root   22944 Dec 12 18:42 test_services_plugin_registry.so
-rw-r--r-- 1 root root   44128 Dec 12 18:42 test_udf_services.so
-rw-r--r-- 1 root root   22720 Dec 12 18:42 udf_example.so
-rw-r--r-- 1 root root   36248 Dec 12 18:42 validate_password.so
-rw-r--r-- 1 root root   56464 Dec 12 18:42 version_token.so

The -server installation only comes with:

-rw-r--r-- 1 root root   25800 Jun 22  2023 adt_null.so
-rw-r--r-- 1 root root   14656 Jun 22  2023 auth_socket.so
-rw-r--r-- 1 root root   31584 Jun 22  2023 authentication_fido_client.so
-rw-r--r-- 1 root root 6681088 Jun 22  2023 authentication_kerberos_client.so
-rw-r--r-- 1 root root 6577488 Jun 22  2023 authentication_ldap_sasl_client.so
-rw-r--r-- 1 root root 6668912 Jun 22  2023 authentication_oci_client.so
-rw-r--r-- 1 root root   19128 Jun 22  2023 component_audit_api_message_emit.so
-rw-r--r-- 1 root root 1843016 Jun 22  2023 component_keyring_file.so
-rw-r--r-- 1 root root   27256 Jun 22  2023 component_log_filter_dragnet.so
-rw-r--r-- 1 root root   35304 Jun 22  2023 component_log_sink_json.so
-rw-r--r-- 1 root root   18960 Jun 22  2023 component_log_sink_syseventlog.so
-rw-r--r-- 1 root root   39656 Jun 22  2023 component_mysqlbackup.so
-rw-r--r-- 1 root root   14688 Jun 22  2023 component_query_attributes.so
-rw-r--r-- 1 root root   43744 Jun 22  2023 component_reference_cache.so
-rw-r--r-- 1 root root   52456 Jun 22  2023 component_validate_password.so
-rw-r--r-- 1 root root   53240 Jun 22  2023 connection_control.so
-rw-r--r-- 1 root root  168808 Jun 22  2023 ddl_rewriter.so
-rw-r--r-- 1 root root 2834336 Jun 22  2023 group_replication.so
-rw-r--r-- 1 root root  101888 Jun 22  2023 innodb_engine.so
-rw-r--r-- 1 root root  114768 Jun 22  2023 keyring_file.so
-rw-r--r-- 1 root root   22976 Jun 22  2023 keyring_udf.so
-rw-r--r-- 1 root root  234328 Jun 22  2023 libmemcached.so
-rw-r--r-- 1 root root   27448 Jun 22  2023 libpluginmecab.so
-rw-r--r-- 1 root root   14128 Jun 22  2023 locking_service.so
-rw-r--r-- 1 root root   15072 Jun 22  2023 mypluglib.so
-rw-r--r-- 1 root root  157024 Jun 22  2023 mysql_clone.so
-rw-r--r-- 1 root root   14392 Jun 22  2023 mysql_no_login.so
-rw-r--r-- 1 root root   65216 Jun 22  2023 rewriter.so
-rw-r--r-- 1 root root   90544 Jun 22  2023 semisync_master.so
-rw-r--r-- 1 root root   35776 Jun 22  2023 semisync_replica.so
-rw-r--r-- 1 root root   35808 Jun 22  2023 semisync_slave.so
-rw-r--r-- 1 root root   90512 Jun 22  2023 semisync_source.so
-rw-r--r-- 1 root root   36280 Jun 22  2023 validate_password.so
-rw-r--r-- 1 root root   52368 Jun 22  2023 version_token.so
yosifkit commented 2 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.
ngan commented 2 months ago

Thanks @yosifkit, I have some follow up questions:

  1. 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; \
    image
  2. I'm running into this prompt during build, any way to bypass this?

image
yosifkit commented 2 months ago

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
ngan commented 2 months ago

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?

ngan commented 2 months ago

Actually, I think I got it to work using:

ARG DEBIAN_FRONTEND=noninteractive

Thanks @yosifkit!

ngan commented 2 months ago

It looks I'm having the key issue for MySQL 5.7 (5.7-debian). Are you guys not pushing to that tag anymore?

tianon commented 2 months ago

https://github.com/docker-library/mysql/pull/1019

ngan commented 2 months ago

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.

ngan commented 2 months ago

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.