Docker on AWS Platform using Docker Machine running on MacOS

Docker is a technology that allows you to build, run, test, and deploy distributed applications that are based on Linux containers. It runs on platform ranging from Raspberry Pi to Cloud platform. Today Docker runs on almost all the Cloud Platform like Amazon, Microsoft, Google etc. Under this post, we will see how to deploy Docker Host on remote AWS platform using Docker Machine.

Pre-requisites:

  • Install “Docker For Mac” using this link
  • Install AWS CLI

Installing AWS CLI on macOS:

  • Download and install Python 3.6 from the downloads page of Python.org.
  • Install pip with the script provided by the Python Packaging Authority.
curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py --user

 

  • Use pip to install the AWS CLI.
pip3 install --user --upgrade awscli

 

  • Verify that the AWS CLI is installed correctly.
aws version

 

Adding Python executable to your PATH

  • Verify the actual location where MacBook installed Python executables:
export PATH=~/Library/Python/3.6/bin/:$PATH
source ~/.bash_profile

 

  • Verify that you can now run aws CLI from anywhere:
aws --version

 

  • Under my MacBook, it displays the below output:

aws-cli/1.11.89 Python/3.6.1 Darwin/16.4.0 botocore/1.5.52

Configuring Credentials

  • Find out AWS Credential by clicking here . Go to  My Security Credentials near top right corner of the same AWS page. Once clicked, Go to Access Key section and click on Show button to display ACCESS KEY ID and SECRET ACCESS KEY.
  • Run the below command on MacBook:

 

aws configure
AWS Access Key ID [None]: <add your access key>
AWS Secret Access Key [None]: <add your secret key>
Default region name [None]: <add your default region>
Default output format [None]:
  • Run the below command to bring up your first node on AWS
sudo docker-machine create --driver amazonec2 node1

 

  • You can verify if new instance gets created under AWS Management Console page as shown below:

  • You can verify that both the nodes are up and running using the below command:
sudo docker-machine ls

In the next post, we will look at setting up Swarm Cluster on AWS Platform.

Leave a Reply

Your email address will not be published. Required fields are marked *