Docker安部署的两种方式装

前言

一:国内源Docker部署

1.1:开局优化

  • 修改主机名

    [root@localhost ~]# hostnamectl set-hostname docker
    [root@localhost ~]# su
    [root@docker ~]# 
    
    
  • 关闭防火墙与核心防护

    [root@docker ~]# systemctl stop firewalld && systemctl disable firewalld
    [root@docker ~]# setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
    
    
  • 网络优化

    [root@docker etc]# echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf	'//开启路由转发'
    [root@docker etc]# sysctl -p
    net.ipv4.ip_forward = 1
    [root@docker etc]# systemctl restart network	'//重启网络服务'
    

1.2:配置环境

  • 环境就不介绍了,直接用一台centos7的虚拟机玩就行

  • 安装必要的系统工具

    [root@localhost ~]# yum -y install yum-utils device-mapper-persistent-data lvm2
    
    
  • 设置阿里云镜像

    [root@docker ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    

1.3:安装Docker(两种方法)

  • 方法一:直接安装社区版

    [root@docker ~]# yum -y install docker-ce  '//安装'
    [root@docker ~]# service docker start	'//启动docker服务'
    [root@docker ~]# docker version		'//查看Docker版本信息'
    
  • 方法二:安装指定版本的Docker

    • 1、查找Docker的版本

      [root@docker ~]# yum list docker-ce.x86_64 --showduplicates | sort -r
      已加载插件:fastestmirror
      已安装的软件包
      可安装的软件包
       * updates: mirrors.njupt.edu.cn
      Loading mirror speeds from cached hostfile
       * extras: mirrors.njupt.edu.cn
      ...省略内容
      docker-ce.x86_64            17.09.0.ce-1.el7.centos            docker-ce-stable 
      docker-ce.x86_64            17.06.2.ce-1.el7.centos            docker-ce-stable 
      docker-ce.x86_64            17.06.1.ce-1.el7.centos            docker-ce-stable 
      docker-ce.x86_64            17.06.0.ce-1.el7.centos            docker-ce-stable 
      ...省略内容
      
    • 2、安装指定版本的Docker

      '//例如安装其中一个版本:17.09.0.ce-1.el7.centos '
      [root@docker ~]# yum -y install docker-ce-17.09.0.ce-1.el7.centos
      

二:国外环境安装Docker

2.1:centos7中的Docker安装

  • Docker软件包已经在默认的CentOS-Extras软件源里,可以直接安装

    yum -y install epel*
    yum -y install docker
    

2.2:部署成功,谢谢赏阅!如有疑问可私信或者评论区交流!

原创文章 172 获赞 97 访问量 5万+

猜你喜欢

转载自blog.csdn.net/CN_TangZheng/article/details/105452665
今日推荐