DEV Community

Cover image for Docker image deploy: from VSCode to Azure in a click
Lucas Santos for Microsoft Azure

Posted on

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, as shown in the image below.

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

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

Select the service

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

See the images

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

See the process as a whole:

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!

Top comments (0)