基于mysql容器安装xtrabackup
FROM mysql:8.0.28-debian
RUN apt-get update \
&& apt-get install -y wget openssh-server \
&& wget https://downloads.percona.com/downloads/Percona-XtraBackup-8.0/Percona-XtraBackup-8.0.28-21/binary/tarball/percona-xtrabackup-8.0.28-21-Linux-x86_64.glibc2.17-minimal.tar.gz \
&& tar -xvf percona-xtrabackup-8.0.28-21-Linux-x86_64.glibc2.17-minimal.tar.gz \
&& mv percona-xtrabackup-8.0.28-21-Linux-x86_64.glibc2.17-minimal /usr/local/xtrabackup \
&& mkdir /run/sshd
ENV PATH=$PATH:/usr/local/xtrabackup/bin
ENV GOSU_VERSION 1.16
ENV MYSQL_MAJOR 8.0
ENV MYSQL_VERSION 8.0.35-1debian11
VOLUME /var/lib/mysql
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 3306 33060
CMD ["mysqld"]
FROM glf9832/mysql-xtrabackup-sshd:8.0.28
RUN apt-get install -y runit
COPY ./id_rsa.pub /root/.ssh/authorized_keys
RUN mkdir /run/sshd \
&& mkdir -p /etc/service/sshd \
&& echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config \
&& echo ' StrictHostKeyChecking no' >> /etc/ssh/ssh_config \
&& chmod 700 /root/.ssh \
&& chmod 600 /root/.ssh/authorized_keys
COPY runit-sshd /etc/service/sshd/run
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /etc/service/sshd/run
ENV PATH=$PATH:/usr/local/xtrabackup/bin
ENV GOSU_VERSION 1.16
ENV MYSQL_MAJOR 8.0
ENV MYSQL_VERSION 8.0.35-1debian11
VOLUME /var/lib/mysql
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 3306 33060
CMD ["mysqld"]
docker run --name mysql -d \
-v /Users/greene/workspace/mysql-data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
-p 3306:3306 \
-p 2222:22 \
glf9832/mysql-xtrabackup-sshd:8.0.28
本文来自博客园,作者:GreeneGe,转载请注明原文链接:https://www.cnblogs.com/greene/p/17830684.html