Editorial Note: This exclusive technical blog is written by our zealous DevOps Engineer Nikit Swaraj.
Docker Cloud, Docker Inc.’s hosted service that helps deploy and manage Dockerized applications, is widely used by DevOps engineers across the world. For the fact that it provides a registry with build and testing facilities for Dockerized application images. It also helps set up and manage host infrastructure, and deployment features to help automate deploying images to an infrastructure.
If you are a DevOps engineer looking to deploy containerized application on Amazon Web Service (AWS) using Docker Cloud, you are at the right place. Here’s a detailed step-by-step guide on how to go about it.
Your Docker Cloud Account and Docker ID
To start with, you need to log in to Docker Cloud using your free Docker ID. Your Docker ID is the same set of credentials you used to log in to the Docker Hub, and this allows you to access your Docker Hub repositories from Docker Cloud.
Images, Builds, and Testing
Docker Cloud uses Docker Hub as an online registry service. This allows you to publish Dockerized images on the internet either publicly or privately. Along with the ability to store pre-built images, Docker Cloud can link to your source code repositories and manage building and testing your images before pushing the images.
Before you can do anything with images, you need to run them somewhere. So, Docker Cloud allows you to link to your infrastructure or cloud service provider, which lets you provision new nodes automatically, and thus help deploy images directly from your Docker Cloud repositories onto your infrastructure hosts.
For illustration, in this post, I am using Amazon Web Services (AWS) as the cloud service provider.
Step1. Link Docker Cloud with your Cloud Infrastructure
When you login to Docker Cloud, the below page appears.
Click on first box (Link Provider), which is asking you to link to a hosted cloud service provider like DigitalOcean or AWS.
A page appears as shown below.
Click on the plug shaped icon and fill your AWS Secret Key and Access Key (The Key associated to that user who have EC2 Full Access Policy attached).
Now, you’re ready to provision the nodes on AWS cloud.
Step2. Create a Node
Go back to the welcome page and click on the second box, which requests you to create a cluster node.
Click on Create and fill every details: Name of the node, details of the provider like AWS, Region, VPC, subnet-id, sec-group, instance type,IAM role, and node disk size, as well as the number of nodes you want.
And then click on Launch node cluster.
After some time you will get to see a page as shown below.
Now, when you take a peek into your AWS console, you will see three instances launched.
Step3: Create a Service
Go back to the welcome page and click on the third box, which requests you to create a service.
Click on Create Service button to open the Services/Wizard page as shown below.
Go to Miscellaneous section and click on dockercloud/hello-world. This will take you to the settings page as shown below.
Fill in the requisite details and go to Container configuration where you can set the entry point, memory limit, CPU limit and the command you want to run to spin up the container.
Now, publish the exposed port 80.
Note: If you want to link this container with another container, then you can use Links. And if you want to set any environment variable or want to attach or mount any volume, you can use Environment variable and Volume section. Once done, click on Create and Deploy. The below image will give you an idea.
When you click on Create and Deploy, your application service will deploy on all the three nodes created in Step 2.
At this moment, your containerized application is deployed on AWS. You can verify it by clicking on endpoints. The below image says it all!
And, voila! There you go.
See its very simple to deploy the containerized application on AWS in no time with Docker Cloud
There are lot other features inside it like monitoring, autoscale, load balancing, etc. You can use these features when the deployment strategy needs to focus on high availability. Need help in deploying containerized application on AWS with the Docker Cloud? We at Minjar have your back! Do share your comments and thought with us on Twitter, Facebook or LinkedIn. You can drop in a comment below too.
P.S: Read my other blog post, Blue Whale Docker on AWS as CaaS, and How Enterprises Can Use it! to know how to leverage DDC as CaaS on AWS.