Customize Deep Learning Containers
We can customize both training and inference with Deep Learning Containers to add custom frameworks, libraries, and packages using Docker files.
Example
In the following example Dockerfile, we added the AWS samples GitHub repo which contains many deep learning model examples into the PyTorch Inference deep learning container.
# Take base container FROM 763104351884.dkr.ecr.us-east-1.amazonaws.com/pytorch-inference:2.4-cpu-py311-ec2 # Add custom stack of code RUN git clone https://github.com/aws-samples/deep-learning-models
Build the Docker image, pointing to your personal Docker registry (usually your username), with the image's custom name and custom tag.
docker build -f Dockerfile -t
<registry>
/<any name>
:<any tag>
Push to your personal Docker Registry:
docker push
<registry>
/<any name>
:<any tag>
You can use the following command to run the container:
docker run -it
< name or tag>
Important
You may need to login to access to the Deep Learning Containers image repository. Specify your region in the following command:
aws ecr get-login-password --region
us-east-1
| docker login --username AWS --password-stdin763104351884
.dkr.ecr.us-east-1
.amazonaws.com