Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: CC-BY-SA-4.0

How Amazon SageMaker Runs Your Training Image

To configure a Docker container to run as an executable, use an ENTRYPOINT instruction in a Dockerfile. Note the following: + For model training, Amazon SageMaker runs the container as follows:

docker run image train

Amazon SageMaker overrides any default CMD statement in a container by specifying the train argument after the image name. The train argument also overrides arguments that you provide using CMD in the Dockerfile.

  + Use the exec form of the ENTRYPOINT instruction:

ENTRYPOINT ["executable", "param1", "param2", ...]

For example:

ENTRYPOINT ["python", "k-means-algorithm.py"]

The exec form of the ENTRYPOINT instruction starts the executable directly, not as a child of /bin/sh. This enables it to receive signals like SIGTERM and SIGKILL from Amazon SageMaker APIs. Note the following:

  + The CreateTrainingJob API has a stopping condition that directs Amazon SageMaker to stop model training after a specific time.