I was looking at options to run some Powershell scripts in Azure and my first idea was: why not start a Windows Server Container with the right Powershell modules and run the scripts there? Turns out there are better options for running Powershell scripts in Azure (Azure Automation Runbooks) so I did not continue on this path but this is really cool technology and I learned a few things so I thought: let’s write this down.
Azure Container Instances
First of all, you can run Docker containers on Azure using Azure Container Instances. ACI is not a container orchestrator like Kubernetes (AKS) but it’s ideal for quickly getting single containers up-and-running. The fastest way to run a container is through the Azure CLI. You can find the CLI directly from the portal:
Running a container
Once you have started the CLI, type or paste the following commands:
The first command sets the default resource location to
westeurope so you do not have to specify this for each command. The second command creates a resource group named
DockerTest and the third command starts a simple Windows Server container with the Nano Server OS, running IIS.
You need to specify a number of parameters when creating a container:
- the name of the resource group for your container resources
- the name of the container group
- the name of the Dockerhub image:
- create a public IP address
- specify that the container should expose port 80
- specify the OS type (ACI does not detect this automatically)
Once you have run these commands, you can check progress via:
And once the container has been provisioned, you should get something like this:
The container has received a public IP address, in my case
126.96.36.199 and when we go there, you see the default IIS welcome page.
Tadaaa, your first Windows Server Container running on Azure.