Condividi tramite


Trying out Docker for Azure (Beta)

Docker for Azure lets you quickly setup and configure a working Docker 1.12.1 swarm-mode install on Microsoft Azure. Currently it's in private beta. You can Sign Up to get access. Once you get the access you would get an email with instructions on how to set it up. It is simply an ARM template which uses the white listed VM Images for the manager and the worker node cluster. Let's see how it works.

Once you have the access email, click on the "Deploy to Azure" button in the email, this would initiate the ARM deployment. You need 2 things before starting the deployment:

  • AD Service Principal  (Docker uses this to operate Azure API's)
  • SSH Key   (To access cluster)
    • Use Putty-gen / ssh-keygen

arm

After the deployment succeeds, get the SSH Host from the "outputs" section of the deployment.

deployment

Now let's login to one of the manager nodes using the SSH value (docker@52.160.102.46) and try out some commands.

> docker node ls nodels

> docker info

info

Now let's deploy a sample application like the example voting app. In order to deploy the app, first we need to create a bundle from the compose file, which has some prerequisites so let's go through them step by step.

Step 1) Clone the GitHub example voting app repository on your local machine.

Step 2) Create 3 new repositories in Docker Hub for vote, worker and result services.

dockerhub

Step 3) Change the docker-compose.yml file as shown below. (Note:  the image names should match with your Docker repository names)

dockeryaml

Step 4) Build all the services and push the images to Docker Hub to generate images with full content hash

  > docker-compose build

  > docker-compose push

  > docker-compose bundle  --push-images

The last command will generate "examplevotingapp.dab" file.

Step 5) Copy the "examplevotingapp.dab" to the manage via scp.

dabfile

Step 6) Deploy the bundle

 > docker deploy --file examplevotingapp.dab jomitvotingstack

deploydab

Step 7) Add the port mappings for each service and list the services:

  >  docker service update --publish-add 80:80 jomitvotingstack_vote

  >  docker service update --publish-add 6379:6379 jomitvotingstack_redis

  >  docker service update --publish-add 8080:80 jomitvotingstack_result

  >  docker service ls servcies-ls

(According to the docs above command should configure the Azure Load Balancer to allow the ports but it wasn't working for me so I had to manually add the rules in the load balancer)

loadbalancer

Finally, browse the Voting and Result App using the 'DEFAULTDNSTARGET' IP from the Deployments "outputs" section.

finalapp

If you have any issues in the result app. Try scaling down the services to 0 and then scale them up again to 1 with db and redis first and then the others..

Comments

  • Anonymous
    September 18, 2016
    Is it a private beta of docker 1.12 of Azure Container Services (which is generally available in previous version of Docker)?
    • Anonymous
      October 06, 2016
      No, this isn't tied with the Azure Container Service. This is a separate effort from Docker to enable quick environment creation in Azure.