FROM ubuntu:20.10 MAINTAINER 1793360097@qq.com # 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 COPY install-db.sh /usr/local/bin/ RUN bash /usr/local/bin/install-db.sh && rm -rf /usr/local/src/* && rm -rf /usr/local/mysql/bin/{mysqltest_embedded,mysql_embedded,mysql_client_test_embedded} /usr/local/mysql/mysql-test RUN mkdir -p /etc/mysql/conf.d/ && echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf \ && rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql/share /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