To deploy a Dockerized Node.js app to Azure App Service, make the server listen on process.env.PORT, build and tag the image, push it to a container registry, and configure App Service to run that exact image. A GitHub Actions workflow can automate the build, push, and deployment. If the container fails to start, check its startup command, runtime dependencies, port configuration, and logs before changing multiple settings.
Choose how Azure will build and run your app
There are two practical deployment paths, and the right one depends on whether you need to control the runtime environment.
As an Amazon Associate I earn from qualifying purchases.
| Approach | Who builds the deployable artifact? | When it fits | What you manage |
|---|---|---|---|
| Deploy app files with App Service build automation | App Service can build the application from deployed files when build automation is enabled. See Microsoft’s GitHub Actions deployment guidance. | When the built-in App Service runtime and build process meet the app’s needs. | Ensure the correct source files and dependencies are deployed, and deliberately enable build automation. |
| Build and deploy a custom container image | Your workflow builds the image before deployment. | When you need to package the app’s runtime, dependencies, or OS-level requirements in an image. | Build and tag the image, push it to a registry, configure registry access, and select the intended image in the App Service deployment step. |
This walkthrough uses a custom container image. It gives the deployment a traceable image version, but requires a registry and image authentication. The workflow below uses Azure Container Registry; its exact configuration depends on your app and Azure setup.
Free tools Windows power users keep installed
One-click scans. No signup required.
Make the Node.js server listen on Azure’s port
Do not make the production server listen only on a hard-coded local port such as 3000. Microsoft says App Service sets PORT in the Node.js container and forwards incoming requests to that port: Configure Node.js Apps – Azure App Service.
#1 Best Overall
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Server listening on ${port}`);
});
The fallback is useful for local development. In App Service, the server should use the port provided in PORT. For a custom container, also make sure its HTTP port configuration matches the port the application serves; App Service custom containers support one exposed HTTP port. See Configure a custom container for Azure App Service.
Build an image that starts the intended service
Your Dockerfile must match the app’s Node.js version, directory layout, package manager, and build process. There is no single correct Dockerfile for every Node app. Whatever the structure, include the production dependencies and application files the server needs, and make the final command launch the server in the foreground so the container remains running.
Rank #2
For example, the Dockerfile’s final command might be CMD ["npm", "start"] if the app defines a production start script. Confirm the script exists and launches the intended server; do not copy this command blindly if your project uses a different entry point. Microsoft’s startup troubleshooting guidance for Azure Container Apps likewise recommends verifying that the image’s start command launches the intended service: Troubleshoot start failures in Azure Container Apps.
Build, push, and deploy the same image
A reliable deployment keeps the image identifier consistent from build through release. Tagging with the commit SHA gives each workflow run a traceable image name, rather than reusing an ambiguous tag such as latest. Microsoft’s example uses Azure Container Registry and a commit SHA: Deploy a custom container to App Service using GitHub Actions.
Rank #3
- Build and tag: Build the Docker image and tag it with the registry name, repository, and commit SHA.
- Push: Authenticate to your container registry and push that tagged image.
- Deploy: Configure the App Service deployment action with the fully qualified image name and tag that were just pushed.
Use the supported App Service deployment action in GitHub Actions, and store registry and Azure authentication credentials as repository secrets rather than committing them. Microsoft’s deployment guidance shows the action and secret-based configuration: Deploy by using GitHub Actions – Azure App Service. The deployment step must select the intended image explicitly; a successful image push alone does not mean App Service is running that image.
Handle compiled apps and deployment artifacts deliberately
For TypeScript and other compiled Node.js apps, ensure the deployable image or artifact contains the compiled output. Microsoft specifically advises building compiled apps in GitHub Actions before deploying their output folder with azure/webapps-deploy@v3: Deploy by Using GitHub Actions – Azure App Service.
Rank #4
With a custom container, arrange the Docker build so the compiled files are present in the final runtime image. With a file-based deployment, deploy the correct output directory, such as dist/ or build/, or intentionally enable App Service build automation. A workflow that deploys source files when the server expects compiled output can produce a deployment that completes but cannot start the app.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallDiagnose the three common failure categories
The app listens on the wrong port
Symptom: The container appears to start, but App Service cannot deliver requests to the Node server. Check: Confirm the server reads process.env.PORT, then verify the custom-container HTTP port setting matches the port the app serves. App Service’s custom-container configuration supports one exposed HTTP port; do not assume a local development port is the right hosting port.
The container exits or never starts the server
Symptom: The container starts and stops, or the app never becomes available. Check: Verify the image’s CMD or entrypoint launches the intended production server and keeps it in the foreground. Then check that required production packages were installed and look for an application exception during startup. A missing script, dependency, or required runtime file can cause an early exit.
The deployed artifact or image is not the one the app needs
Symptom: The deployment step completes, but the expected app version or compiled app does not run. Check: For a container deployment, compare the fully qualified image name and tag in the workflow’s deploy step with the image that was built and pushed. For a compiled app, confirm the build ran and the resulting output was included in the deployed image or directory.
Use logs to identify the fault before changing settings
Enable container logging and inspect the output from the app and deployment before changing the port, image, and startup command all at once. Azure documents these CLI commands for App Service logging:
az webapp log config --name <app-name> --resource-group <resource-group> --docker-container-logging filesystem
az webapp log tail --name <app-name> --resource-group <resource-group>
Replace the angle-bracketed values with your App Service name and resource group. The first command configures container logging to the filesystem; the second streams available logs. See Configure a custom container for Azure App Service and Enable diagnostic logging for apps in Azure App Service. Use the startup output to distinguish a port mismatch from a missing command, dependency, or runtime exception, then fix the identified cause and redeploy.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




