Skip to content

Latest commit

 

History

History
200 lines (131 loc) · 10.7 KB

anomaly-detector-container-howto.md

File metadata and controls

200 lines (131 loc) · 10.7 KB
title titleSuffix description author manager ms.service ms.topic ms.date ms.author keywords
Install and run Docker containers for the Anomaly Detector API
Azure AI services
Use the Anomaly Detector API's algorithms to find anomalies in your data, on-premises using a Docker container.
mrbullwinkle
nitinme
azure-ai-anomaly-detector
how-to
01/18/2024
mbullwin
on-premises, Docker, container, streaming, algorithms

Install and run Docker containers for the Anomaly Detector API

[!INCLUDE Deprecation announcement]

[!INCLUDE container image location note]

Containers enable you to use the Anomaly Detector API your own environment. Containers are great for specific security and data governance requirements. In this article you'll learn how to download, install, and run an Anomaly Detector container.

Anomaly Detector offers a single Docker container for using the API on-premises. Use the container to:

  • Use the Anomaly Detector's algorithms on your data
  • Monitor streaming data, and detect anomalies as they occur in real-time.
  • Detect anomalies throughout your data set as a batch.
  • Detect trend change points in your data set as a batch.
  • Adjust the anomaly detection algorithm's sensitivity to better fit your data.

For detailed information about the API, please see:

If you don't have an Azure subscription, create a free account before you begin.

Prerequisites

You must meet the following prerequisites before using Anomaly Detector containers:

Required Purpose
Docker Engine You need the Docker Engine installed on a host computer. Docker provides packages that configure the Docker environment on macOS, Windows, and Linux. For a primer on Docker and container basics, see the Docker overview.

Docker must be configured to allow the containers to connect with and send billing data to Azure.

On Windows, Docker must also be configured to support Linux containers.

Familiarity with Docker You should have a basic understanding of Docker concepts, like registries, repositories, containers, and container images, as well as knowledge of basic docker commands.
Anomaly Detector resource In order to use these containers, you must have:

An Azure Anomaly Detector resource to get the associated API key and endpoint URI. Both values are available on the Azure portal's Anomaly Detector Overview and Keys pages and are required to start the container.

{API_KEY}: One of the two available resource keys on the Keys page

{ENDPOINT_URI}: The endpoint as provided on the Overview page

[!INCLUDE Gathering required container parameters]

The host computer

[!INCLUDE Host Computer requirements]

Container requirements and recommendations

The following table describes the minimum and recommended CPU cores and memory to allocate for Anomaly Detector container.

QPS(Queries per second) Minimum Recommended
10 QPS 4 core, 1-GB memory 8 core 2-GB memory
20 QPS 8 core, 2-GB memory 16 core 4-GB memory

Each core must be at least 2.6 gigahertz (GHz) or faster.

Core and memory correspond to the --cpus and --memory settings, which are used as part of the docker run command.

Get the container image with docker pull

The Anomaly Detector container image can be found on the mcr.microsoft.com container registry syndicate. It resides within the azure-cognitive-services/decision repository and is named anomaly-detector. The fully qualified container image name is mcr.microsoft.com/azure-cognitive-services/decision/anomaly-detector.

To use the latest version of the container, you can use the latest tag. You can also find a full list of image tags on the MCR.

Use the docker pull command to download a container image.

Container Repository
cognitive-services-anomaly-detector mcr.microsoft.com/azure-cognitive-services/decision/anomaly-detector:latest

Tip

When using docker pull, pay close attention to the casing of the container registry, repository, container image name and corresponding tag. They are case sensitive.

[!INCLUDE Tip for using docker list]

Docker pull for the Anomaly Detector container

docker pull mcr.microsoft.com/azure-cognitive-services/anomaly-detector:latest

How to use the container

Once the container is on the host computer, use the following process to work with the container.

  1. Run the container, with the required billing settings. More examples of the docker run command are available.
  2. Query the container's prediction endpoint.

Run the container with docker run

Use the docker run command to run the container. Refer to gather required parameters for details on how to get the {ENDPOINT_URI} and {API_KEY} values.

Examples of the docker run command are available.

docker run --rm -it -p 5000:5000 --memory 4g --cpus 1 \
mcr.microsoft.com/azure-cognitive-services/decision/anomaly-detector:latest \
Eula=accept \
Billing={ENDPOINT_URI} \
ApiKey={API_KEY}

This command:

  • Runs an Anomaly Detector container from the container image
  • Allocates one CPU core and 4 gigabytes (GB) of memory
  • Exposes TCP port 5000 and allocates a pseudo-TTY for the container
  • Automatically removes the container after it exits. The container image is still available on the host computer.

Important

The Eula, Billing, and ApiKey options must be specified to run the container; otherwise, the container won't start. For more information, see Billing.

Running multiple containers on the same host

If you intend to run multiple containers with exposed ports, make sure to run each container with a different port. For example, run the first container on port 5000 and the second container on port 5001.

Replace the <container-registry> and <container-name> with the values of the containers you use. These do not have to be the same container. You can have the Anomaly Detector container and the LUIS container running on the HOST together or you can have multiple Anomaly Detector containers running.

Run the first container on host port 5000.

docker run --rm -it -p 5000:5000 --memory 4g --cpus 1 \
<container-registry>/microsoft/<container-name> \
Eula=accept \
Billing={ENDPOINT_URI} \
ApiKey={API_KEY}

Run the second container on host port 5001.

docker run --rm -it -p 5001:5000 --memory 4g --cpus 1 \
<container-registry>/microsoft/<container-name> \
Eula=accept \
Billing={ENDPOINT_URI} \
ApiKey={API_KEY}

Each subsequent container should be on a different port.

Query the container's prediction endpoint

The container provides REST-based query prediction endpoint APIs.

Use the host, http://localhost:5000, for container APIs.

[!INCLUDE Container API documentation]

Stop the container

[!INCLUDE How to stop the container]

Troubleshooting

If you run the container with an output mount and logging enabled, the container generates log files that are helpful to troubleshoot issues that happen while starting or running the container.

[!INCLUDE Azure AI services FAQ note]

[!INCLUDE Diagnostic container]

Billing

The Anomaly Detector containers send billing information to Azure, using an Anomaly Detector resource on your Azure account.

[!INCLUDE Container's Billing Settings]

For more information about these options, see Configure containers.

Summary

In this article, you learned concepts and workflow for downloading, installing, and running Anomaly Detector containers. In summary:

  • Anomaly Detector provides one Linux container for Docker, encapsulating anomaly detection with batch vs streaming, expected range inference, and sensitivity tuning.
  • Container images are downloaded from a private Azure Container Registry dedicated for containers.
  • Container images run in Docker.
  • You can use either the REST API or SDK to call operations in Anomaly Detector containers by specifying the host URI of the container.
  • You must specify billing information when instantiating a container.

Important

Azure AI containers are not licensed to run without being connected to Azure for metering. Customers need to enable the containers to communicate billing information with the metering service at all times. Azure AI containers do not send customer data (e.g., the time series data that is being analyzed) to Microsoft.

Next steps