Sunday, January 29, 2017

How to Install Docker on Amazon EC2 Redhat Linux?

How to Install docker on EC2 Redhat Linux?

Let's see how to install docker on EC2 on Redhat Linux.

Pre-requisites
1. OS requirements - You need the 64-bit version of Redhat Enterprise Linux 7.
2. Remove unofficial docker packages. Sometimes your machine can contain older version of Docker with the package name docker instead of docker-engine.
    You can uninstall by executing the below command:
    $ sudo yum -y remove docker

Install Docker    You can install Docker in three different ways, depending on your needs:

    1. Install from Docker's repositories. This is the recommended approach.
    2. Download the RPM package and install it manually and manage upgrades completely manually.
    3. Some users cannot use third-party repositories, and must rely on the version of Docker in the Red Hat repositories. This version of Docker may be out of date. Those users should consult the Red Hat documentation and not follow these procedures.

 Install using the repository(recommended approach)
Before you install Docker for the first time on a new host machine, you need to set up the Docker repository. Afterwards, you can install, update, or downgrade Docker from the repository.
Set up the repository

    Install yum-utils, which provides the yum-config-manager utility:

    $ sudo yum install -y yum-utils

    Use the following command to set up the stable repository:

    $ sudo yum-config-manager \
        --add-repo \
        https://docs.docker.com/engine/installation/linux/repo_files/centos/docker.repo

Install Docker

Update the yum package index.

$ sudo yum makecache fast

If this is the first time you have refreshed the package index since adding the Docker repositories, you will be prompted to accept the GPG key, and the key’s fingerprint will be shown. Verify that the fingerprint matches 58118E89F3A912897C070ADBF76221572C52609D and if so, accept the key.

Install the latest version of Docker, or go to the next step to install a specific version.

$ sudo yum -y install docker-engine

On production systems, you should install a specific version of Docker instead of always using the latest. List the available versions. This example uses the sort -r command to sort the results by version number, highest to lowest, and is truncated.

    Note: This yum list command only shows binary packages. To show source packages as well, omit the .x86_64 from the package name.

$ yum list docker-engine.x86_64  --showduplicates |sort -r

$ sudo yum -y install docker-engine-<VERSION_STRING>

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

$ sudo docker run hello-world

2 comments:

  1. I get a lot of great information here and this is what I am searching for. Thank you for your sharing. I have bookmark this page for my future reference. Search aws jobs in hyderabad

    ReplyDelete
  2. devops questions Following my last blog post..In this post, we will take a gander at how to send two Docker compartments on AWS Elastic Beanstalk Applications.

    ReplyDelete