Using Docker containers with SageMaker - Amazon SageMaker

Using Docker containers with SageMaker

Amazon SageMaker makes extensive use of Docker containers for build and runtime tasks. SageMaker provides prebuilt Docker images for its built-in algorithms and the supported deep learning frameworks used for training and inference. Using containers, you can train machine learning algorithms and deploy models quickly and reliably at any scale. The topics in this section show how to deploy these containers for your own use cases. For information on how to bring your own containers for use with Amazon SageMaker Studio, see Bring your own SageMaker image.

Scenarios for Running Scripts, Training Algorithms, or Deploying Models with SageMaker

Amazon SageMaker always uses Docker containers when running scripts, training algorithms, and deploying models. However, your level of engagement with containers depends on your use case.

  • Use a built-in SageMaker algorithm or framework. For most use cases, you can use the built-in algorithms and frameworks without worrying about containers. You can train and deploy these algorithms from the SageMaker console, the AWS Command Line Interface (AWS CLI), a Python notebook, or the Amazon SageMaker Python SDK by specifying the algorithm or framework version when creating your Estimator. The built-in algorithms available are itemized and described in the Use Amazon SageMaker Built-in Algorithms or Pre-trained Models topic. For more information on the available frameworks, see ML Frameworks and Toolkits. For an example of how to train and deploy a built-in algorithm using a Jupyter notebook running in a SageMaker notebook instance, see the Get Started with Amazon SageMaker topic.

  • Use prebuilt SageMaker container images. Alternatively, you can use the built-in algorithms and frameworks using Docker containers. SageMaker provides containers for its built-in algorithms and prebuilt Docker images for some of the most common machine learning frameworks, such as Apache MXNet, TensorFlow, PyTorch, and Chainer. For a full list of the available SageMaker Images, see Available Deep Learning Containers Images. It also supports machine learning libraries such as scikit-learn and SparkML. If you use the Amazon SageMaker Python SDK, you can deploy the containers by passing the full container URI to their respective SageMaker SDK Estimator class. For the full list of deep learning frameworks currently supported by SageMaker, see Prebuilt SageMaker Docker Images for Deep Learning. For information on the scikit-learn and SparkML prebuilt container images, see Prebuilt Amazon SageMaker Docker Images for Scikit-learn and Spark ML . For more information about using frameworks with the Amazon SageMaker Python SDK, see their respective topics in Use Machine Learning Frameworks, Python, and R with Amazon SageMaker.

  • Extend a prebuilt SageMaker container image. If you would like to extend a prebuilt SageMaker algorithm or model Docker image, you can modify the SageMaker image to satisfy your needs. For an example, see Extending our PyTorch containers.

  • Adapt an existing container image: If you would like to adapt a pre-existing container image to work with SageMaker, you need to modify the Docker container to enable either the SageMaker Training or Inference toolkit. For an example that shows how to build your own containers to train and host an algorithm, see Bring Your Own R Algorithm.