Deploy an Azure API Management self-hosted gateway to Docker

This article provides the steps for deploying self-hosted Azure API Management gateway into a Docker environment.


Self-hosted gateway feature is in preview. During the preview, the self-hosted gateway is available only in the Developer and Premium tiers at no additional charge. Developer tier is limited to a single self-hosted gateway deployment.



Self-hosted gateway is packaged as a Linux-based Docker container.

Deploy the self-hosted gateway to Docker

  1. Select Gateways from under Settings.
  2. Select the gateway resource you intend to deploy.
  3. Select Deployment.
  4. Note that a new token in the Token text box was autogenerated for you using the default Expiry and Secret Key values. Adjust either or both if desired and select Generate to create a new token.
  5. Make sure Docker is selected under Deployment scripts.
  6. Select env.conf file link next to the Environment to download the file.
  7. Select copy icon located at the right end of the Run text box to save the Docker command to clipboard.
  8. Paste the command to the terminal (or command) window. Adjust the port mappings and container name as needed. Note that the command expects the downloaded environment file to be present in the current directory.
    docker run -d -p 80:8080 -p 443:8081 --name <gateway-name> --env-file env.conf<tag>
  1. Execute the command. The command instructs your Docker environment to run the container, using self-hosted gateway's image downloaded from the Microsoft Container Registry, and to map the container's HTTP (8080) and HTTPS (8081) ports to ports 80 and 443 on the host.
  2. Run the below command to check the gateway pod is running:
docker ps
CONTAINER ID        IMAGE                                                 COMMAND                  CREATED             STATUS              PORTS                                         NAMES
895ef0ecf13b   "/bin/sh -c 'dotnet …"   5 seconds ago       Up 3 seconds>8080/tcp,>8081/tcp   my-gateway
  1. Go back to Azure portal and confirm that gateway node you just deployed is reporting healthy status.

gateway status


Use console docker container logs command to view a snapshot of self-hosted gateway log.

Use docker container logs --help command to see all log viewing options.

Next steps