Docker image deploy: from VSCode to Azure in a click
Tags: docker, azure, containers, devops
Published: 2020-09-26 00:15:38

We commented [in this post on my blog (PT)](https://blog.lsantos.dev/executando-containers-no-azure-container-instancies-com-docker/) that Docker would be gaining __native__ integration with Azure! With this integration, deploying a docker image directly to [Azure Container Instances (ACI)](https://docs.microsoft.com/azure/container-instances/quickstart-docker-cli?WT.mc_id=blog-personal&WT.mc_id=blog-devto-ludossan) would be as easy as a single command in the Docker CLI.

The integration was already present in Docker Edge, which is the beta version of Docker. Now we have the excellent [news](https://azure.microsoft.com/blog/azure-container-instances-docker-integration-now-in-docker-desktop-stable-release/?WT.mc_id=blog-personal&WT.mc_id=blog-devto-ludossan -ludossan) that this integration has arrived for all Docker users! And, together with her, now __we have the same direct integration in [VSCode](https://code.visualstudio.com/?WT.mc_id=blog-devto-ludossan)__!

And how can we use it?

## Enabling integration with VSCode

First, we need to have Docker installed on the machine. If you don't already have it then go to [the official website](https://www.docker.com/products/docker-desktop) and download the `stable` version for your operating system.

Once you download and install Docker, log in to Azure using the following command:

`` bash
azure docker login
``

And then create a new context using the command `docker context create aci <name>`, the context name is up to you!

Now, go to the [VSCode marketplace](https://code.visualstudio.com/?WT.mc_id=blog-devto-ludossan), download and install the [official Docker extension for Code](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker&WT.mc_id=blog-devto-ludossan). It should appear in the left corner of the screen, as shown in the image below.

![](https://github.com/microsoft/vscode-docker/raw/master/resources/readme/overview.gif)

Notice that, at the end of the sidebar, we will have a menu called __Contexts__. Open it and right click on the context you just created. Select _Use_:

![Select the context we are going to operate](https://dev-to-uploads.s3.amazonaws.com/i/5ev97xe4s9p8w0ydevm8.png)

With the context selected, we already have everything we need to do our deploy.

## Deploying to ACI

With the extension, we can login to our DockerHub or [Azure Container Registry](https://azure.microsoft.com/services/container-registry/?WT.mc_id=blog-devto-ludossan):

![Click the connect button to login](https://dev-to-uploads.s3.amazonaws.com/i/dcsjlaidttf4suzbbzyd.png)

From there we can select the type of record we are using

![Select the service](https://dev-to-uploads.s3.amazonaws.com/i/m9n2ftrx6tl86op2seni.png)

And then we will have the list of our images hosted on these services:

![See the images](https://dev-to-uploads.s3.amazonaws.com/i/rdf7hb8pk6g4h4bf5k3l.png)

Now we can open and select one of the images, right click, and select _"Deploy Image to Azure Container Instances"_:

![](https://dev-to-uploads.s3.amazonaws.com/i/f3lbedqclscbpcv55hmw.png)

See the process as a whole:

![](https://azurecomcdn.azureedge.net/mediahandler/acomblog/media/Default/blog/9b424351-84c1-4f45-b23f-e34a18d24a9f.gif)

From there you will have prompts to enter the name of your ACI or if you want to use an existing one, and you can also bring the logs, open ports and more!

## Conclusion

The native integration of Docker with ACI is one of the most interesting tools we have when we are referring to the cloud. This direct integration capability makes it much easier to carry out our deploys and also manage our containers.

If you want to know more, see [the official integration documentation](https://docs.microsoft.com/azure/container-instances/quickstart-docker-cli?WT.mc_id=blog-devto-ludossan) and also read [the documentation on the Docker website](https://docs.docker.com/engine/context/aci-integration/).

See you!