版本docker-ce17
Uninstall old versions
Older versions of Docker were called docker or docker-engine. If these are installed, uninstall them, along with associated dependencies.
docker-common \
container-selinux \
docker-selinux \
docker-engine```
It’s OK if yum reports that none of these packages are installed.
The contents of ```/var/lib/docker/```, including images, containers, volumes, and networks, are preserved. The Docker CE package is now called ```docker-ce```, and the Docker EE package is now called ```docker-ee```.
####Install Docker
You can install Docker in different ways, depending on your needs:
1.Most users [set up Docker’s repositories](https://docs.docker.com/engine/installation/linux/#install-using-the-repository) and install from them, for ease of installation and upgrade tasks. This is the recommended approach.
2.Some users download the RPM package and install it manually and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.
####Install using the repository
Before you install Docker 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
Repository set-up instructions are different for [Docker CE](https://docs.docker.com/engine/installation/linux/#docker-ce) and [Docker EE](https://docs.docker.com/engine/installation/linux/#docker-ee).
####Docker CE
Install yum-utils, which provides the yum-config-manager utility:
```$ sudo yum install -y yum-utils```
Use the following command to set up the **stable** repository. You always need the **stable** repository, even if you want to install **edge** builds as well.
```$ sudo yum-config-manager --add-repo \https://download.docker.com/linux/centos/docker-ce.repo```
**Optional**: Enable the **edge** repository. This repository is included in the docker.repo
file above but is disabled by default. You can enable it alongside the stable repository.
```$ sudo yum-config-manager --enable docker-ce-edge```
You can disable the **edge** repository by running the yum-config-manager
command with the --disable
flag. To re-enable it, use the --enable
flag. The following command disables the **edge** repository.
```$ sudo yum-config-manager --disable docker-ce-edge```
[Learn about **stable** and **edge** builds](https://docs.docker.com/engine/installation/).