标签:des process 客户 cal months 火墙 perm memcached 准备
docker pull centos:6
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos 6 70b5d81549ec 2 months ago 195MB
mkdir -p /data/docker/lnmp-test/dockerfile/mysql
vim /data/docker/lnmp-test/dockerfile/mysql/Dockerfile
FROM centos:6
LABEL maintainer="1012405802@qq.com" description="Mysql image"
ENV MYSQL_VERSION 5.6.25
COPY packages /root/packages
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 && CMAKE=" -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc/mysql -DMYSQL_DATADIR=/data/mysql -DWITH_SSL=system -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci" && yum -y install cmake gcc gcc-c++ ncurses-devel bison-devel bison openssl-devel perl perl-devel && groupadd mysql && useradd -M -s /sbin/nologin mysql -g mysql && tar -zxvf /root/packages/mysql-$MYSQL_VERSION.tar.gz -C /root/packages && cd /root/packages/mysql-$MYSQL_VERSION && cmake $CMAKE && make -j $(getconf _NPROCESSORS_ONLN) && make install && mkdir -p /etc/mysql && mkdir -p /data/mysql && cp support-files/my-default.cnf /etc/mysql/my.cnf && ln -s /usr/local/mysql/bin/* /usr/local/bin/ && cp /root/packages/startup.sh /root/startup.sh && chmod +x /root/startup.sh && rm -rf /root/packages && yum clean all
EXPOSE 3306
CMD ["/root/startup.sh"]
cat startup.sh
#!/bin/sh
chown -R mysql:mysql /data/mysql
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql --user=mysql --defaults-file=/etc/mysql/my.cnf
/usr/local/mysql/support-files/mysql.server start
mysql -e "grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘;"
mysql -e "grant all privileges on *.* to ‘root‘@‘localhost‘ identified by ‘123456‘;"
/usr/local/mysql/support-files/mysql.server stop
/usr/local/mysql/bin/mysqld_safe
cd /data/docker/lnmp-test/dockerfile/mysql/
docker build -t centos6:mysql .
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos6 mysql 11017a938926 9 seconds ago 1.35GB
centos 6 70b5d81549ec 2 months ago 195MB
docker run -d -p 3306:3306 --name mysql centos6:mysql
firewall-cmd --add-port=3306/tcp --permanent
systemctl restart firewalld
DockerFile部署lnmp+memcached+redis+mongodb开发环境for MySQL(二)
标签:des process 客户 cal months 火墙 perm memcached 准备
原文地址:https://www.cnblogs.com/93bok/p/9684964.html