Installing Docker on CentOS/RedHat

in #utopian-io7 years ago (edited)

docker-facebook.png

Docker is an open source tool, designed to create, deploy and run applications easily and quickly by using containers. It packages, provisions and runs containers independent of the OS. It is developed in Go language.
Containers allows packaging an application with all the libraries, configuration files and dependencies as one single image. This helps the developers to be rest assured that the application will run on any other machine regardless of settings that the machine might have that could differ from the machine used for writing and testing the code.

Docker use kernel of the host system on which the applications are running. It shares the services of underlying operating system. This gives a significant performance boost and reduces the size of application.

Docker was created to work on Linux platforms. However, non-linux operating systems like Microsoft Windows and Apple OS X are also supported. Versions for Amazon Web Services (AWS) and Microsoft Azure is also available.

Features

  • Easy and faster delivery of application
  • Deploy and scale easily
  • Increase Productivity
  • Applicatin isolation
  • Easier management

In this tutorial, let us see how to install community version of Docker from its repository as well as from its package, on CentOS.

Requirements

  • Minimum version of CentOS 7
  • The centos-extras repository must be enabled. This repository is enabled by default, but if you have disabled it, you need to re-enable it.
  • The overlay2 storage driver is recommended.

Installation From Repository

  • Install required packages : yum-utils, device-mapper-persistent-data and lvm2.
    yum-utils provides the yum-config-manager utility and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver needed by Docker.

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

install_dependencies.gif

  • Add the stable Docker repository.

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

add_repo.gif

  • Install the community version of Docker, docker-ce.

yum install -y docker-ce

dockeR_install.gif

  • Start Docker service.

systemctl start docker

  • Verify that the Docker service has started. The service should be in running state.

systemctl status docker

start_service.gif

  • Verify that docker is installed correctly by running the hello-world image.

docker run hello-world

hello_world.gif

  • Check the version of docker.

docker --version

version.gif

Installation from Package

  • We'll download Docker's RPM using wget. If wget is not availble, install it using yum.

yum install -y wget

wget.gif

wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm

  • Install the downloaded RPM using yum.

yum localinstall docker-ce-17.12.0.ce-1.el7.centos.x86_64.rpm

install.gif

  • Start the Docker service.

systemctl start docker

  • Verify that the Docker service has started. The service should be in running state.

systemctl status docker

status.gif

  • Verify that docker is installed correctly by running the hello-world image.

docker run hello-world

hello.gif

  • Check the version of docker.

docker --version

docker_version.gif

If you have any questions or comments, I'd would love to hear from you in comment section.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because it does not follow the Utopian Rules.

  • Installations tutorials are very trivial and easy. They really won’t provide benefits in the platform.
    You can contact us on Discord.
    [utopian-moderator]