zoukankan      html  css  js  c++  java
  • Centos 7.4 自动初始化docker环境,配置docker镜像仓库

    #/bin/bash
    #Auto configuration docker env
    #Author yarn
    #2018-9-10 11:53:45
    ######################
    REGISTRY=www.registry.example.cn
    HOST_NAME=application
    cat /etc/redhat-release
    read -p "If your operating system version is Centos Linux 7.4 (Croe),Please press yes,If not press no:" anw
    case $anw in
    [Yy][Ee][Ss]|[Yy])
      systemctl status firewalld
      systemctl stop firewalld
      systemctl disable firewalld
      setenforce 0
      hostnamectl set-hostname $HOST_NAME
      sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/sysconfig/selinux
      yum -y install vim zip unzip rsync yum-utils device-mapper-persistent-data lvm2
      yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
      yum makecache fast
      yum -y install docker-ce
      systemctl start docker
      touch /etc/docker/daemon.json
      echo '{"registry-mirrors": ["https://registry.docker-cn.com"]}' >> /etc/docker/daemon.json
      echo '{"insecure-registries": ["http://$REGISTRY:5000"]} ' >> /etc/docker/daemon.json
      sed -i s#ExecStart=/usr/bin/dockerd#"ExecStart=/usr/bin/dockerd --insecure-registry=$REGISTRY:5000"#g /usr/lib/systemd/system/docker.service
      systemctl daemon-reload
      systemctl restart docker
      docker ps
    ;; [Nn][Oo]|[Nn])   exit 1 ;; esac

      

  • 相关阅读:
    04_远程管理常用命令
    03_文件和目录常用命令
    02_Linux 终端命令格式
    01_常用 Linux 命令的基本使用
    test
    centOS 7 更改root密码
    安装 centos7
    1
    IO模型
    使用git连接到Github
  • 原文地址:https://www.cnblogs.com/xyarn/p/9620712.html
Copyright © 2011-2022 走看看