Docker image deploy: from VSCode to Azure in a click

We commented in this post on my blog (PT) that Docker would be gaining native integration with Azure! With this integration, deploying a docker image directly to Azure Container Instances (ACI) 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 that this integration has arrived for all Docker users! And, together with her, now we have the same direct integration in VSCode!

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 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, download and install the official Docker extension for Code. It should appear in the left corner of the screen/

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:

Docker image deploy: from VSCode to Azure in a click

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:

Click the connect button to login

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

Docker image deploy: from VSCode to Azure in a click

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

Docker image deploy: from VSCode to Azure in a click

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

Docker image deploy: from VSCode to Azure in a click

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 and also read the documentation on the Docker website.

See you!

About the Author:

Developer since 2011, working with high availability web and cloud native applications since 2013 and homebrewer in the free time. Microsoft MVP Reconnect and Google GDE. Loves communities <3

Reference:

Santos, L. (2020). Docker image deploy: from VSCode to Azure in a click. Available at: https://dev.to/azure/docker-image-deploy-from-vscode-to-azure-in-a-click-5193 [Accessed: 12th November 2020].

Share this on...

Rate this Post:

Share:

Topics:

Azure