Installing Docker and Docker-compass on CentOS

System Information of the host system used for this practical:

Hardware details:

(Use the command lscpu to get these details) :

Architecture:                  x86_64                   
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 158
Model name: Intel(R) Core(TM) i7-8750H CPU @
2.20GHz

OS details:

(Use the command cat /etc/os-release to retrieve these details)

Name:              "CentOS Linux"      
Version: 7 (Core)"
ID: "centos"
ID_LIKE: "rhel fedora"

Lets Start……….

To remove the existing installation:

Remove existing docker installations to avoid conflicts…

sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

Install the required packages:

yum-utils includes the ‘yum-config-manager’ for configuring repository (Source of docker installation)

device mapper and Ivm2 is required for the storage driver ‘devicemapper’

Note: ‘\’ is used for multiline command in Linux…

sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2

Set docker repository:

sudo yum-config-manager \
     --add-repo \
     https://download.docker.com/linux/centos/docker-ce.repo

Remove Conflic packages:

The podman and buildah packages conflict with docker-ce. Remove them first:

sudo yum erase podman buildah

Install docker ce:

We will install the docker community edition (CE)…

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

Start docker daemon:

Start the Docker daemon …

sudo systemctl start docker

To add the daemon service to system start-up :

We can start daemon each time or add the daemon to start up by running below command…

 sudo systemctl enable docker.service 

To test installation :

We can check whether the docker service can download images from ‘docker hub’ (a public repository of free docker images) and use it, by running below command…

docker run hello-world

Installing Docker compass……………………

Download Docker compose binaries:

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

Here $(uname -s) and (uname -m) gives the Operating system (Linux) and Processor type (64 bit)… Just run the command inside the brackets and see the output for yourself.

-o indicates the destination to which the files should be downloaded

Make the contents executable:

sudo chmod +x /usr/local/bin/docker-compose

This is same as chmod 777 , +x is the another way of presenting executable permission

Create symbolic link:

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Now we can access the docker-compass file from terminal

Try ‘docker-compose –version’