Docker Tutorial
Docker Installation
How to use Docker
Docker Instance
Docker Container Lifecycle Command
Docker Container Operation Command
Docker Container rootfs Command
Docker Mirror Repository Command
Docker Local Image Management Command
Docker info|version Command
Docker supports the following 64-bit CentOS versions:
The installation command is as follows:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
Older Docker versions were called docker or docker-engine. If these programs are installed, uninstall them and their associated dependencies.
$ sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
Before installing Docker Engine-Community for the first time on a new host, you need to set up the Docker repository. After that, you can install and update Docker from the repository.
Set up warehouse
Install the required packages. yum-utils provides yum-config-manager, and the device mapper storage driver requires device-mapper-persistent-data and lvm2.
$ sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2
Use the following commands to set up a stable repository.
$ sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
Install the latest versions of Docker Engine-Community and containerd, or go to the next step to install a specific version:
$ sudo yum install docker-ce docker-ce-cli containerd.io
Select Yes if you are prompted to accept the GPG key.
Have multiple Docker repositories?
If multiple Docker repositories are enabled, installs or updates made without specifying a version in the yum install or yum update command will always install the highest version, which may not be suitable for your stability needs.
Docker is not started by default after installation. And the docker user group has been created, but there are no users under the user group.
To install a specific version of Docker Engine-Community, list the available versions in the repository, then select and install:
1. List and sort the versions available in your repository. This example sorts the results by version number (highest to lowest).
$ yum list docker-ce --showduplicates | sort -r docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
2. Install a specific version by its full package name, which is the package name (docker-ce) plus the version string (second column), from the first colon (:) to the first hyphens, separated by a hyphen (-). For example: docker-ce-18.09.1.
$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
Start Docker.
$ sudo systemctl start docker
Verify that Docker Engine-Community is installed correctly by running the hello-world image.
$ sudo docker run hello-world
Remove the installation package:
yum remove docker-ce
Delete images, containers, configuration files, etc.:
rm -rf /var/lib/docker