3 min read

VS Code Docker extension can now run containers in Azure Container Instances

Today we are releasing version 1.4 of our Visual Studio Code Docker extension, which makes it easy to build, manage, and deploy containerized applications from Visual Studio Code (VS Code). In this release, you can now view and troubleshoot containers deployed in Azure Container Instances (ACI) from within VS Code. If you are using, or plan to use, the Docker Azure integration, the new features released today will make you much more productive.

Docker Azure integration

The integration of Docker with Microsoft Azure was recently released by Docker and is available in the Edge release of Docker Desktop. With it you can use the Docker CLI to run your single-container applications in Azure Container Instances (ACI) using docker run. You can also deploy multi-container applications defined with a Docker Compose file using docker compose up.

With Azure Container Instances (ACI), you can run your dev/test or production containers in the cloud without needing to set up any infrastructure. Because there is no infrastructure or platform management overhead, ACI caters to those who need to quickly run containers in the cloud with minimal operational overhead. ACI has a pay-as-you-go pricing model, which means you will only be billed for consumed CPU and memory consumption per second, essentially only when the container is running.

Docker tools in VS Code

The new Docker CLI is a great way to run, view, and troubleshoot containers in Azure Container Instances (ACI). And now the Docker extension in VS Code gives you a great interactive experience to do the same. With the new release of our Docker extension, from within VS Code you can switch from a traditional Docker context to a Docker ACI context and then view and troubleshoot all the containers deployed in ACI.

Before you can use an Azure Container Instances (ACI) context, you first must create one. The Docker CLI has new docker login azure and docker context create aci commands you can use to log into Azure and create an ACI context, but the VS Code Docker tools make that easier as well. Click the plus sign (+) in the header area of the Contexts panel and you will see an interactive UI experience that lets you select the Azure subscription you want to use and an existing Azure resource group, or create a new one.

Once you have done that, you will see the new ACI context show up in the Contexts panel. Right-click and select “Use” from the menu to make this context the active one. You will notice the Containers panel will refresh and show all the containers you have deployed in ACI in the current context. You can now right-click on a container and select an action such as “Attach Shell” or “View Logs,” something you probably often do today with your local Docker context (which is the one named “default” in the Contexts panel).

GIF of View and troubleshoot containers deployed in Azure Container Instances (ACI)

Figure 1: View and troubleshoot containers deployed in Azure Container Instances (ACI)

You will notice many of the other panels such as Images do not show any content, and in fact say, “This view is not supported in the current Docker context.” This is because ACI does not have a specific container registry associated with it by design. You may be using Azure Container Registry (ACR) and/or Docker Hub.

Grouping images

Something we recently added to our VS Code Docker tools is the ability to group containers in the Containers panel by Compose project name. The panel now groups your containers using the Compose project name, which gets set when you run docker compose up. The Compose project name is set to the name of the folder containing the Compose file or you can override it with the -p option. This handy grouping works for existing contexts, such as the default one, as well as the new Azure Container Instances (ACI) contexts.

GIF of how to Group containers by compose a project name

Figure 2: Group containers by Compose project name

Try it today

If you haven’t already, make sure to download the Visual Studio Code Docker extension and the Edge release of Docker Desktop and get started deploying and troubleshooting containers in Azure Container Instances (ACI) using the Docker CLI and VS Code. A great way of getting started is to use the Azure Container Instances (ACI) quickstart. We encourage you to leave your comments below or submit an issue on the GitHub repo.