-
Uninstall old versions
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
-
Install using the repository
Install required packages.
install -y yum-utils device-mapper-persistent-data lvm2
Use the following command to set up the stable repository.
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
-
INSTALL DOCKER ENGINE - COMMUNITY
Install the latest version of Docker Engine - Community and containerd.
yum install docker-ce docker-ce-cli containerd.io
To install a specific version of Docker Engine - Community, list the available versions in the repo, then select and install:
yum list docker-ce --showduplicates | sort -r yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
Start Docker.
systemctl start docker
Verify that Docker Engine - Community is installed correctly by running thehello-world
image.
docker run hello-world
-
Install from a package
Go to https://download.docker.com/ and download the.rpm
file for the Docker version you want to install.
#!
Install Docker Engine - Community
yum install /path/to/package.rpm
Start Docker.
Verify that Docker Engine - Community is installed correctly by running thehello-world
image.
systemctl start docker docker run hello-world
-
Install using the convenience script
This example uses the script at get.docker.com to install the latest release of Docker Engine - Community on Linux. To install the latest testing version, use test.docker.com instead. In each of the commands below, replace each occurrence ofget
withtest
.
curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh #非 root 操作 usermod -aG docker your-user
-
Uninstall Docker Engine - Community
# Uninstall the Docker package: yum remove docker-ce # Images, containers, volumes, or customized configuration files on #your host are not automatically removed. To delete all images, #containers, and volumes: rm -rf /var/lib/docker
-
Install Docker Engine - Community from binaries
- Download the static binary archive. Go to https://download.docker.com/linux/static/stable/ (or change
stable
tonightly
ortest
), choose your hardware platform, and download the.tgz
file relating to the version of Docker Engine - Community you want to install. - Extract the archive using the
tar
utility. Thedockerd
anddocker
binaries are extracted. - Optional: Move the binaries to a directory on your executable path, such as
/usr/bin/
. If you skip this step, you must provide the path to the executable when you invokedocker
ordockerd
commands. - Start the Docker daemon:
./dockerd &
- Daemon configuration file (default "/etc/docker/daemon.json")
Location of client config files (default "/root/.docker")
- Download the static binary archive. Go to https://download.docker.com/linux/static/stable/ (or change
dockerd &