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.
Class DockerSection constructor.
- Inheritance
-
azureml._base_sdk_common.abstract_run_config_element._AbstractRunConfigElementDockerSection
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")
# Specify docker steps as a string.
dockerfile = r'''
FROM mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.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
Name | Description |
---|---|
enabled
|
Indicates whether to perform this run inside a Docker container. Default is False. DEPRECATED: Use the azureml.core.runconfig.DockerConfiguration class. |
base_image
|
The base image used for Docker-based runs. Mutually exclusive with "base_dockerfile" and "build_context" variables. Example value: "ubuntu:latest". |
base_dockerfile
|
The base Dockerfile used for Docker-based runs. Mutually exclusive with "base_image" and "build_context" variables. Example: line 1 "FROM ubuntu:latest" followed by line 2 "RUN echo 'Hello world!'". The default is None. |
build_context
|
The Docker build context to use to create the environment. Mutually exclusive with "base_image" and "base_dockerfile" variables. The default is None. |
base_image_registry
|
Image registry that contains the base image. |
platform
|
Operating System and CPU architecture the image of the docker image. |
enabled
|
Indicates whether to perform this run inside a Docker container. Default is False. DEPRECATED: Use the azureml.core.runconfig.DockerConfiguration class. |
shared_volumes
|
Indicates whether to use shared volumes. Set to False if necessary to work around shared volume bugs on Windows. The default is True. DEPRECATED: Use the azureml.core.runconfig.DockerConfiguration class. |
gpu_support
|
DEPRECATED. Azure Machine Learning now automatically detects and uses NVIDIA Docker extension when available. |
arguments
|
Extra arguments to pass to the Docker run command. The default is None. DEPRECATED: Use the azureml.core.runconfig.DockerConfiguration class. |
Attributes
arguments
DEPRECATED. Use the azureml.core.runconfig.DockerConfiguration class.
base_dockerfile
Get or set base dockerfile used for Docker-based runs.
base_image
Get or set base image used for Docker-based runs.
build_context
Get or set Docker build context used for Docker-based runs.
enabled
DEPRECATED. Use the azureml.core.runconfig.DockerConfiguration class.
gpu_support
DEPRECATED. Azure automatically detects and uses the NVIDIA Docker extension when it is available.
shared_volumes
DEPRECATED. Use the azureml.core.runconfig.DockerConfiguration class.
shm_size
DEPRECATED. Use the azureml.core.runconfig.DockerConfiguration class.