Docker部署
使用官方yum仓库 [root@linux-node1 ~]# yum install -y yum-utils [root@linux-node1 ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo 使用国内Yum源 [root@linux-node1 ~]# cd /etc/yum.repos.d/ [root@linux-node1 /etc/yum.repos.d]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo Docker安装 [root@linux-node1 ~]# yum install -y docker-ce 启动后台进程: [root@linux-node1 ~]# systemctl start docker [root@linux-node1 ~]# systemctl enable docker [root@linux-node1 ~]# docker --version Docker version 19.03.8, build afacb8b [root@linux-node1 ~]# docker version 启动docker后,docker会帮助我们创建一个docker0的网桥 [root@linux-node1 ~]# ifconfig docker0 docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 ether 02:42:a6:e5:98:b5 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 docker状态信息 [root@linux-node1 ~]# docker info Docker Hub Docker之所以能这么快的火起来,和Docker Hub的作用是分不开的。 Docker构建了像GitHub一样的仓库,用来存放大家构建好的Docker镜像,其中已经包括了超过15,000的镜像。 大部分需求,都可以通过在 Docker Hub 中直接下载镜像来实现。 搜索镜像 [root@linux-node1 ~]# docker search centos NAME DESCRIPTION STARS OFFICIAL AUTOMATED centos The official build of CentOS. 5897 [OK] ansible/centos7-ansible Ansible on Centos7 128 [OK] jdeathe/centos-ssh OpenSSH / Supervisor / EPEL/IUS/SCL Repos - … 114 [OK] consol/centos-xfce-vnc Centos container with "headless" VNC session… 111 [OK] 输出依次为镜像名字、描述、星级(表示该镜像的受欢迎程度)、是否官方创建、是否自动创建。OFFICIAL为OK的就是官方镜像。 配置docker镜像加速 如果你的网络不行,请配置以下信息。 [root@linux-node1 ~]# vim /etc/docker/daemon.json { "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"] } [root@linux-node1 ~]# systemctl restart docker