# vim:set ft=dockerfile: FROM alpine:latest RUN \ addgroup -S mysql \ && adduser -S -h /var/lib/mysql -H -D -G mysql mysql \ && mkdir /docker-entrypoint-initdb.d \ && apk --no-cache add \ bash \ mariadb \ mariadb-client \ pwgen \ socat \ su-exec \ tzdata \ # comment out any "user" entires in the MySQL config # ("docker-entrypoint.sh" or "--user" will handle user switching) && sed -ri 's/^user\s/#&/' /etc/mysql/my.cnf \ # increase innodb buffer pool size && sed -i 's/^#innodb_buffer_pool_size = 16M/innodb_buffer_pool_size = 30M/' /etc/mysql/my.cnf \ # purge and re-create /var/lib/mysql with appropriate ownership && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /run/mysqld \ && chown -R mysql:mysql /var/lib/mysql /run/mysqld \ # ensure that /run/mysqld (used for socket and lock files) is writable # regardless of the UID our mysqld instance ends up having at runtime && chmod 777 /run/mysqld \ # don't reverse lookup hostnames, they are usually another container && sed -i 's/\[mysqld\]/[mysqld]\nskip-host-cache/' /etc/mysql/my.cnf COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] CMD ["mysqld"]