Docker的基本组成

  1. Docker Client 客户端
  2. Docker daemon 守护进程
  3. Docker Image 镜像
    • Docker 镜像就好比一个模板,可以通过这个模板来创建容器服务,tomcat 镜像⇒run tomcat1容器中(提供服务器),通过这个镜像可以创建多个容器,最终服务运行或项目运行就是在容器中的
  4. Docker Container 容器
    • Docker利用容器技术,独立运行一个或者一组应用,通过镜像来创建
    • 启动、停止、删除、基本命令
    • 目的就可以把这个容器理解为就是一个简易的Linux系统
  5. Docker Registry 仓库
    • 仓库就是存放惊险的地方
    • 仓库分为公有仓库和私有仓库
    • Docker hub 国外的
    • 阿里云等都用容器服务器(我们可以配置镜像加速)

安装Docker

环境准备

  1. 需要一点点Linux基础
  2. 使用CentOS系统
  3. 使用Xshell远程连接

开始安装

  • 根据官方文档信息:我们卸载旧的版本

    sudo yum remove docker
    docker-client
    docker-client-latest
    docker-common
    docker-latest
    docker-latest-logrotate
    docker-logrotate
    docker-engine

  • 安装Docker存储库 Install using the repository

    yum install -y yum-utils

  • 设置镜像的仓库 Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository

    sudo yum-config-manager
    –add-repo
    https://download.docker.com/linux/centos/docker-ce.repo
    上面默认使用的是国外的镜像地址 我们可以使用阿里云国内镜像
    sudo yum-config-manager –add-repo http://mirrors.aliyuncs.com/docker-ce/linux/centos/docker-ce.repo

  • 安装Docker引擎之前我们可以更新一下yum 软件包索引

    yum makecache fast

  • 安装Docker引擎 Install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:安装最新的引擎或其他具体的版本

    sudo yum install docker-ce docker-ce-cli containerd.io

  • 安装指定版本

    sudo yum install docker-ce- docker-ce-cli- containerd.io

  • 测试有没有安装成功Verify that Docker Engine is installed correctly by running the hello-world image

    sudo docker run hello-world

  • 查看当前下载的镜像

    docker images

  • 卸载docker

    卸载依赖
    sudo yum remove docker-ce docker-ce-cli containerd.io
    删除docker的运行环境资源
    rm -rf /var/lib/docker
    docker 的默认工作路径

Docker运行分析图