Docker deployment options

Hi there,

I am trying to figure out the best (or just a) way to deploy docker images (coming from a build server) to Azure.

There are so many ways, and I can’t seem to find the right fit. There are a lot of orchestration frameworks (Docker Swarm, Service Fabric and Kubernetes), but at this stage it seems like a bit of an overkill to what we are trying to achieve.

My next thought was: let’s just create a web app and use this guide:

But I can’t figure out how to deploy this either (Azure Web App won’t work), and the docker deploy seems to be incorrect as well.

Basically (at this stage) I would like to have something like this:

  1. MyApp.Authentication
  2. MyApp.MyService1
  3. MyApp.MyService2

Each project is a separate container and will be pushed to the private container registry separately (this is already configured & working). Now I need to somehow be able to deploy the generated docker images to some sort of azure thing. What would you recommend? At this stage I would take anything just to be able to create / replace a web app / container service for specific version of the container.

Thanks!

Hi, thanks for reaching out.

For quick deployments of containers to Azure without worrying about infrastructure you might want to look at Azure Container Instances (https://docs.microsoft.com/en-us/azure/container-instances/container-instances-quickstart).

For example, deploying the HTTPD app to ACI can be done with a Run an Azure Powershell Script step taking advantage of an additional package reference. Additional packages were added to Octopus in 2018.8, and are documented at https://octopus.com/docs/deployment-examples/custom-scripts/standalone-scripts#referencing-packages.

So the Azure script would be something like this:

az group create --name myResourceGroup --location eastus
az container create --resource-group myResourceGroup --name httpd --image $OctopusParameters["Octopus.Action.Package[httpd].PackageId"] --dns-name-label my-octopus-httpd-app --ports 80
az container show --resource-group myResourceGroup --name httpd --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" --out table

And the additional package would reference the docker image.

This is a screenshot of an example step that deploys the HTTPD container to ACI.

At this point the container version is selected like any other package during deployment, so you can deploy to ACI like it was a typical deployment target.

Regards
Matt C

1 Like

Thanks for the reply. Took me a bit of investigation, but here are the final scripts I am using:

az container create --resource-group #{MyAppResourceGroup} --name #{MyAppContainerName} --image #{MyAppRegistryUrl}/#{PackageName}:#{MyAppPackageVersion} --dns-name-label #{MyAppDnsLabel} --os-type #{MyAppOsType} --registry-username #{MyAppRegistryUsername} --registry-password #{MyAppRegistryPassword} --ip-address public --ports 80 443
az container show --resource-group #{MyAppResourceGroup} --name #{MyAppContainerName} --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" --out table

Then I can create multiple projects where I only have to define 1 or 2 variables (the rest is a library variable set) and the projects are ready to go.