Quick install of Docker on CentOS 7

OS requirements

This article assumes you have a clean server.
To install Docker CE, you need a maintained version of CentOS 7.
Archived versions aren’t supported or tested.
The centos-extras repository is required.
The overlay2 storage driver is recommended.

Setup the repository

Before you install Docker CE 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. Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.

$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo


$ sudo yum install docker-ce docker-ce-cli containerd.io

Start Docker.

$ sudo systemctl start docker

Verify that Docker CE 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. Docker CE is installed and running.

Was this answer helpful? 1 Users Found This Useful (1 Votes)