I am basically totally fed up with Docker and Sagemaker at this point
I have finally managed to create a local Docker contain whichg conforms to the expected Sagemaker interface - ie has /ping [GET] and /invocations [POST] endpoints, and has a serve
executable in /usr/local/bin
which starts a webserver
I then created a Sagemaker model/endpoint_config/endpoint combo using boto3
However endpoint creation fails due to
exec /usr/local/bin/serve: exec format error
which seems to indicate a compatability issue between the Mac M1 on which the container was built, and the Amazon Linux machine on which it runs
So much for write once, run anywhere!
Docker seem to have a solution for this called build images -
docker buildx version
docker buildx create --name mybuilder --use
docker buildx inspect --bootstrap
docker buildx build --platform linux/amd64 -t bert-word-alignment . --load
docker image inspect bert-word-alignment --format '{{.Architecture}}'
Howver this seems to want to suck in an enormous amount of Python nvidia cuda dependencies, and the resulting image is gigantic; so much so that the webserver seems to run out of memory when the image is run
So I'm going off elsewhere to see if I can build the image on Amazon Linux via Codebuild
As a parting shot I tried to replace the model/endpoint_config/endpoint creation routines with a Cloudformation file; but ran into some errors regarding the maximum permitted length of entity name; so giving up and moving on
The good bits here are that this gives a decent overview of Docker, and also managed to build a working container with webserver; one that is probably compatible with Sagemaker, if only the container can be built on a compatible OS