Customizing an existing framework container
Of course, we could simply write a Dockerfile referencing one of the Deep Learning Containers images (https://github.com/aws/deep-learning-containers/blob/master/available_images.md) and add our own commands. See the following example:
FROM 763104351884.dkr.ecr.us-east-1.amazonaws.com/tensorflow-training:2.4.1-cpu-py37-ubuntu18.04 . . .
Instead, let's customize and rebuild the PyTorch training and inference containers on our local machine. The process is similar to other frameworks.
Build environment
Docker needs to be installed and running. To avoid throttling when pulling base images, I recommend that you create a Docker Hub account (https://hub.docker.com) and log in with docker login
or Docker Desktop.
To avoid bizarre dependency issues (I'm looking at you, macOS), I also recommend that you build images on an Amazon EC2 instance powered by Amazon Linux 2. You don't need a large one (m5.large
should suffice...