zoukankan      html  css  js  c++  java
  • centos7 ssh dockerfile

    centos7 ssh  dockerfile

    FROM centos:centos7.7.1908
    ENV PATH $PATH:/usr/local/mysql/bin/

    RUN yum -y install wget
    RUN rm -rf /etc/yum.repos.d/*
    RUN cd /etc/yum.repos.d/
    && wget http://mirrors.aliyun.com/repo/Centos-7.repo
    && wget http://mirrors.aliyun.com/repo/epel-7.repo
    RUN yum clean all
    RUN yum install -y openssh-server bind-utils sysstat telnet net-tools glibc-common gcc automake autoconf libtool make gcc-c++ unzip libaio-devel numactl vim openssh*

    RUN sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
    RUN sed -i 's/#UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config

    RUN echo '123456' | passwd --stdin root
    RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
    RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key


    COPY mysql /usr/local/mysql
    ADD my.cnf /etc/

    RUN mkdir -p /data/mysql/mysql3306/{data,logs,temp}
    && groupadd mysql
    && useradd -g mysql -s /sbin/nologin -d /usr/local/mysql -MN mysql
    && echo "PATH=$PATH:/usr/local/mysql/bin/" >>/etc/profile
    && chown -R mysql.mysql /data/mysql

    RUN chown -R mysql.mysql /usr/local/mysql

    # ------------------------------------------------------------------------------
    ADD localtime /etc/localtime

    RUN mkdir /var/run/sshd

    WORKDIR /root/

    EXPOSE 22
    CMD ["/usr/sbin/sshd", "-D"]

    docker run -d  --name master  -h master centos7-ssh-test
    docker run -d  --name slave1  -h slave1 centos7-ssh-test
    docker run -d  --name slave2  -h slave2 centos7-ssh-test
    docker run -d  --name slave3  -h slave3 centos7-ssh-test
    docker run -d  --name proxysql  -h proxysql --privileged centos7-ssh-test /usr/sbin/init
  • 相关阅读:
    注意:开发环境不同,启动代码不同…
    6410在rvds下编译启动代码报错分析
    S3C6410的启动代码分析 一
    s3c6410开发板LED驱动程序设计详细…
    季逸超:90后IT少年的“盖茨梦”
    我的博客今天0岁52天了,我领取了…
    在linux中获取错误返回信息 &…
    各种居中对齐
    文本对齐方式
    素描人像
  • 原文地址:https://www.cnblogs.com/fengjian2016/p/12496438.html
Copyright © 2011-2022 走看看