1.Linuxyum源切换阿里云软件源

  • 备份本机软件源

    • mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 
  • 下载新的CentOS-Base.repo 到/etc/yum.repos.d/

    • CentOS 5

      • get -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

        或者

      • curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
    • CentOS 6

      • wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

        或者

      • curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    • CentOS 7

      • wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 

        或者

      • curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

  之后运行yum makecache生成缓存

    •   yum makecache

 

2.Docker国内Yum源和国内镜像仓库

  使用阿里云Docker Yum源

    sudo yum install -y yum-utils device-mapper-persistent-data lvm2
    sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    sudo yum makecache fast
    sudo yum -y install docker-ce

  Docker常用命令:
    docker version
    docker images
    docker ps -a
    docker rm xxx
    docker rmi xxx
    docker stop xxx
    docker kill xxx
    docker run -it --restart=always

    systemctl enable docker
    systemctl status docker
    service docker start
    service docker restart
    service docker stop

05-23 23:14