Objectives

  • Install Docker on CentOS Linux 7
  • Verify Docker installation
  • Start and enable Docker Engine

Prerequisites

  • 64-bit CentOS Linux 7

 Sequence 1. Installing Docker

  1. Old version of Docker packages are available in the official repository of CentOS. Login as root user and remove old version, if installed.

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

  1. Install Yum Utils

# yum install -y yum-utils

  1. Configure Latest Docker Repository

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

  1. Install Latest version of Docker

# yum install -y docker-ce docker-ce-cli containerd.io

  1. After installation is complete, start the Docker daemon:

# systemctl start docker

  1. Verify that it’s running and, make sure it starts at every server reboot:

# systemctl status docker # systemctl enable docker

  1. The output should be similar to the following, showing that the service is active and running:

 Sequence 2. Verify Docker Installation

Using docker consists of passing it a chain of options and subcommands followed by arguments. The syntax is: docker [option] [command] [arguments]

  1. To view all available subcommands, type:

# docker

  1. To view the switches available to a specific command, type:

# docker docker-subcommand --help

  1. To view system-wide information, use:

# docker info   https://youtu.be/HH4bQhHaxII