Thursday, 26 December 2019

Steps to create Docker Container registry in Azure for Single Container | Docker part 2

Simple steps by following which we can create Azure container registry. Thing which we will be covering in this post:
  1. Create new resource group.
  2. Create new Container registry.
  3. Get access key from registry.
  4. Login in to registry by using access key in local machine's Power shell .
  5. Tag an existing image from local machine which been created by docker-compose up --build.
  6. Push the tagged image to container registry.
  7. Verify registry.
  8. Run & verify instance.
  9. Deploy registry as Web-app.
  10. Verify public URL.

Create a New resource group - Demo_docker_resource_group

Create a Container registry - rajkrsdemodocker

Go to > Container registry - rajkrsdemodocker > Access key

Now connect this registry through from local machine
PS D:\repos\docker\linux_redis_netcore\linux_redis_netcore> docker login rajkrsdemodocker.azurecr.io
Username: rajkrsdemodocker
Password:
Login Succeeded



PS D:\repos\docker\linux_redis_netcore\linux_redis_netcore> docker tag dockerdemowebapp rajkrsdemodocker.azurecr.io/dockerdemowebapp

PS D:\repos\docker\linux_redis_netcore\linux_redis_netcore> docker push rajkrsdemodocker.azurecr.io/dockerdemowebapp
The push refers to repository [rajkrsdemodocker.azurecr.io/dockerdemowebapp]
03c412d9bb76: Pushed
5c85cde35eaf: Pushed
5788d77a8c40: Pushed
a2f9ed91e120: Pushed
75bb365bb264: Pushed
99b5261d397c: Pushed
latest: digest: sha256:e3d1fd269341856dd581d5cd8fd75b1346204a99f1b724dbccd1f136d3de4867 size: 1581


Now go to
Home > All resources > rajkrsdemodocker - Repositories > dockerdemowebapp

To create instance of image
Select image > latest > Option > Run instance 
You will be getting script to download instance like:
docker pull rajkrsdemodocker.azurecr.io/dockerdemowebapp:latest
Or
To deploy as web
Select image > latest > Option > Deploy to web
You will be getting notification of deployment of web app and can get web app info from Webappserviceplan > App(s) / Slots >
rajkrs-demo-dockerwebapp https://rajkrs-demo-dockerwebapp.azurewebsites.net