FROM mysql:latest as builder
ENV MYSQL_ALLOW_EMPTY_PASSWORD=1
ENV MYSQL_USER=testuser
ENV MYSQL_PASSWORD=pass
ENV MYSQL_DATABASE=enterprise
RUN [“sed”, “-i”, “s/exec "$@"/echo "not running $@"/”, “/usr/local/bin/docker-entrypoint.sh”]
COPY enterprise.sql /docker-entrypoint-initdb.d/
COPY databases.sql /docker-entrypoint-initdb.d/
RUN [“/usr/local/bin/docker-entrypoint.sh”, “mysqld”, “–disable-log-bin”, “–default-authentication-plugin=mysql_native_password”, “–datadir”, “/initialized-db”]
FROM mysql:latest
LABEL org.label-schema.project=np
org.label-schema.vendor=“PK”
org.label-schema.name=sample-data
org.label-schema.base=1
COPY --from=builder /initialized-db /var/lib/mysql
I get such an error:
[builder 5/5] RUN [“/usr/local/bin/docker-entrypoint.sh”, “mysqld”, “–disable-log-bin”, “–default-authentication-plugin=mysql_native_password”, “–datadir”, “/initialized-db”]:
0.115 2023-09-12 13:43:19+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.1.0-1.el8 started.
0.318 2023-09-12 13:43:19+00:00 [Note] [Entrypoint]: Switching to dedicated user ‘mysql’
0.327 2023-09-12 13:43:19+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.1.0-1.el8 started.
0.518 2023-09-12 13:43:19+00:00 [Note] [Entrypoint]: Initializing database files
0.533 mysqld: Can’t create directory ‘/initialized-db/’ (OS errno 17 - File exists)
0.533 2023-09-12T13:43:19.904190Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
0.533 2023-09-12T13:43:19.906323Z 0 [Warning] [MY-010918] [Server] ‘default_authentication_plugin’ is deprecated and will be removed in a future release. Please use authentication_policy instead.
0.533 2023-09-12T13:43:19.906348Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.1.0) initializing of server in progress as process 79
0.533 2023-09-12T13:43:19.906423Z 0 [ERROR] [MY-010338] [Server] Can’t find error-message file ‘/usr/share/mysql-8.1/errmsg.sys’. Check error-message file location and ‘lc-messages-dir’ configuration directive.
0.533 2023-09-12T13:43:19.907649Z 0 [ERROR] [MY-013236] [Server] The designated data directory /initialized-db/ is unusable. You can remove all files that the server added to it.
0.534 2023-09-12T13:43:19.907766Z 0 [ERROR] [MY-010119] [Server] Aborting
0.534 2023-09-12T13:43:19.907949Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.1.0) MySQL Community Server - GPL.
0.534 2023-09-12T13:43:19.908187Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end.