Installing Docker on AWS EC2

You can easily install Docker on the AWS EC2 instance. Let's connect the EC2 instance using PuTTY. In this section, we will install Docker on the EC2 instance. Follow these steps to install Docker:

  1. Let's run the EC2 instance and generate a private key using PuTTYgen. You have to load the dineshonjava.pem file that we generated in the previous section. It will generate the dineshonjava.ppk file. It will be used to connect the EC2 instance using Putty.
  1. Open Putty and connect to the EC2 instance. In Host Name, use Public DNS to connect this EC2 instance and port 22. Also, load the private key file for authentication. In the category section, go to Connection | SSH | Auth and upload the private key file for authentication, as shown in the following screenshot:
  1. Upload a private key file, dineshonjava.ppk, and click on the Open button. It will connect to the AWS EC2 instance, as shown in the following screenshot:

As you can see in the preceding screenshot, we have connected to the AWS EC2 instance using Putty. Now you can easily install Docker on the EC2 instance.

  1. Install Docker, using the following command:
$ sudo yum install docker
  1. Start the Docker service, using the following command:
$ sudo service docker start

Let's see the following screenshot about the preceding command:

  1. The preceding command will install Docker on the EC2 instance. Verify the installation with the following command:
$ sudo docker version

Let's see the following screenshot about the preceding command:

As you can see in the preceding screenshot, we have successfully installed Docker on the AWS EC2 instance. Let's see in the next section how to run the microservice on the AWS EC2 instance using Docker images.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset