Skip to content

Packaging app

KavinKrishnan edited this page Sep 11, 2021 · 29 revisions

In this step, the MONAI SDK application can now be built into a deployable Docker image using the MONAI Application Packager

Overview on MONAI Application Packager

The MONAI Application Packager (Packager) is a utility for building an application developed with the MONAI SDK into a structured MONAI application package (MAP).

The MAP produced by the Packager is a deployable and reusable docker image that can be launched locally or remotely

Basic Usage of MONAI Application Packager

monai-deploy package [Path of MONAI Application Code] -t [Tag for resulting Docker image of MONAI App Package]

Required Arguments

  • <MONAI application path> Path of MONAI Application Code
  • --tag, -t Tag for resulting Docker image of MONAI App Package

Optional Arguments

The following list contains arguments which have default values or are provided through the SDK if these flags are not invoked. However the user can choose to override these values by invoking these optional flags

  • --base Base Application Image (overrides default "nvcr.io/nvidia/pytorch:21.07-py3")
  • --input-dir, -i Directory mounted in container for Application Input (overrides default "input")
  • --models-dir Directory mounted in container for Models Path (overrides default "/opt/monai/models")
  • --model, -m Path to local directory containing all application models (will override utilizing models provided within application SDK code)
  • --output-dir, -o Directory mounted in container for Application Output (overrides default "output")
  • --timeout Timeout (overrides default 0)
  • --version Version of the Application (overrides default "0.0.0")
  • --working-dir, -w Directory mounted in container for Application (overrides default "/var/monai")

Example of using MONAI Application Packager

Given an example MONAI SDK application with its code residing in a directory ./spleen_segmentation_app, packaging this application with the Packager to create an Docker image tagged monaispleen:latest would look like this:

$ monai-deploy package ./spleen_segmentation_app -t monaispleen:latest
Building MONAI Application Package...
Successfully built monaispleen:latest

The MAP image monaispleen:latest will be seen in the list of container images on the user's local machine when docker images is run. The MAP image monaispleen:latest will be able to run locally or remotely

Notes on Current Implementation of MONAI Application Packager

  • The current implementation (as of 0.0.0) of the Packager ONLY supports CUDA and Pytorch images from nvcr.io as base images for the MAP. There are efforts in progress to add support for smaller images from dockerhub.
  • This release was developed and tested with CUDA 11 and Python 3.8. There are efforts in progress to add support for different versions of the CUDA tootlkit.

See the next page to learn more on how to locally run a MONAI application package image built by the Packager