Before you install Docker Engine - Community 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 required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-dataand lvm2 are required by the devicemapper storage driver.
$ sudo yum install -y yum-utils \
Use the following command to set up the stable repository.
INSTALL DOCKER ENGINE - COMMUNITY
1. Install the latest version 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
2. Start Docker.
$ sudo systemctl start docker
$ sudo systemctl enable docker
3. Verify that Docker Engine - Community is installed correctly by running the hello-world image.
$ sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.