DockerSection Class

Defines settings to customize the Docker image built to the environment's specifications.

The DockerSection class is used in the Environment class to customize and control the final resulting Docker image that contains the specified environment.

Inheritance
azureml._base_sdk_common.abstract_run_config_element._AbstractRunConfigElement
DockerSection

Constructor

DockerSection(**kwargs)

Remarks

The following example shows how to load docker steps as a string.


   from azureml.core import Environment
   myenv = Environment(name="myenv")

   # Creates the environment inside a Docker container.
   myenv.docker.enabled = True

   # Specify docker steps as a string.
   dockerfile = r'''
   FROM mcr.microsoft.com/azureml/intelmpi2018.3-ubuntu16.04
   RUN echo "Hello from custom container!"
   '''

   # Alternatively, load from a file.
   #with open("dockerfiles/Dockerfile", "r") as f:
   #    dockerfile=f.read()

   myenv.docker.base_dockerfile = dockerfile

For more information about using Docker in environments, see the article Enable Docker.

Variables

enabled
bool

Indicates whether to perform this run inside a Docker container. Default is False.

base_image
str

The base image used for Docker-based runs. Mutually exclusive with the "base_dockerfile" variable. Example value: "ubuntu:latest".

base_dockerfile
str

The base Dockerfile used for Docker-based runs. Mutually exclusive with "base_image" variable. Example: line 1 "FROM ubuntu:latest" followed by line 2 "RUN echo 'Hello world!'". The default is None.

shared_volumes
bool

Indicates whether to use shared volumes. Set to False if necessary to work around shared volume bugs on Windows. The default is True.

gpu_support
bool

DEPRECATED. Azure Machine Learning now automatically detects and uses NVIDIA Docker extension when available.

arguments
list

Extra arguments to pass to the Docker run command. The default is None.

base_image_registry
ContainerRegistry

Image registry that contains the base image.

Attributes

base_dockerfile

Get or set base dockerfile used for Docker-based runs.

base_image

Get or set base image used for Docker-based runs.

gpu_support

DEPRECATED. Azure automatically detects and uses the NVIDIA Docker extension when it is available.