Docker CE

Check centos-extras repo is enabled, i.e. enabled=0

$ sudo cat /etc/yum.repos.d/CentOS-Sources.repo

.
.
.
#additional packages that may be useful
[extras-source]
name=CentOS-$releasever - Extras Sources
baseurl=http://vault.centos.org/centos/$releasever/extras/Source/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
.
.
.

Remove any existing versions of docker

# Ensure there isn't an existing instance of docker on the server
sudo yum remove docker \
    docker-client \
    docker-client-latest \
    docker-common \
    docker-latest \
    docker-latest-logrotate \
    docker-logrotate \
    docker-selinux \
    docker-engine-selinux \
    docker-engine

Configure the docker repository

$ 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

Install, start and test docker-ce

# Install docker community edition
$ sudo yum install docker-ce docker-ce-cli containerd.io

# Enable docker to start at boot
$ sudo systemctl enable docker

# Manually start docker
$ sudo systemctl start docker

# Test Docker
$ sudo docker run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/


Docker Compose

Install Docker compose (Version 1.23.2 at the time of writing).

# Download compose
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# Enable execute permissions.
$ sudo chmod +x /usr/local/bin/docker-compose

Add location to global path

# Create the below file to update the PATH variable.
$ sudo vim /etc/profile.d/env.sh
PATH="$PATH:/usr/local/bin/"

# Reload the environment variables.
$ source ~/.bash_profile

# Test compose
$ docker-compose --version
docker-compose version 1.23.2, build 1110ad01

Official Doco