Linux安装Docker

Uninstall old versions

Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them, along with associated dependencies.

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

Linux安装Docker

Install using the repository

Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

SET UP THE REPOSITORY

Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository.

 sudo yum install -y yum-utils
![](https://img2020.cnblogs.com/blog/2296296/202103/2296296-20210311100342041-1500321842.png)

#使用官方镜像
 sudo yum-config-manager     --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
#使用阿里云加速
 sudo yum-config-manager  	--add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Linux安装Docker

INSTALL DOCKER ENGINE

  1. 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
    

Linux安装Docker

  1. Start Docker.

     sudo systemctl status docker
     sudo systemctl enable docker
     sudo systemctl start docker
    

Uninstall Docker Engine

  1. Uninstall the Docker Engine, CLI, and Containerd packages:

    sudo yum remove docker-ce docker-ce-cli containerd.io
    
  2. Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:

     sudo rm -rf /var/lib/docker
     sudo rm -rf /var/lib/containerd
    

Linux安装Docker

上一篇:linux shell命令之join


下一篇:如何在centos和linux等主机上安装 pstree