Azure Web Apps - SSH access for Custom Containers

For most "smaller" projects I use Azure Web Apps for hosting. It just takes care of all the work of hosting sites, APIs, and Apps in a PaaS manor, so I don't have to worry about it.

Azure Web Apps - SSH access for Custom Containers
Photo by Luca Bravo / Unsplash

For most "smaller" projects I use Azure Web Apps for hosting. It just takes care of all the work of hosting sites, APIs, and Apps in a PaaS manor, so I don't have to worry about it.

I tend to put most of the apps I work on into containers and then host them on a Linux App Service Plan. This gives me a nice clean level of separation and means my local env is very similar to the production env I am using.

However, there is one small problem with Azure Web Apps that I have not found a clean correct solution to and that regard exposing SSH access to Kudu in Azure Web Apps. Specifically, the problem is not getting the container setup, with the classic "init.sh" entrypoint which starts the sshd and also the app itself. But rather getting Kudu to start the docker container with more than one exposed port.

I nice little hack to work around this constraint is to setup the Web App Service Application Configuration "Websites_Port" with the port you want to be exposed but also slide in a Docker port binding directive.

It should look something like this:

Save it and the site should restart. Then got to SSH access and you should be in:


Click here:

If this all works you should be presented with a clean new login ssh terminal, logged in as root like such:

If MS updated the App Service so this is handled more cleanly, I'll update the post in future but for now, this hack appears to work well and solves my login problems over ssh to my custom container.