Deploying custom Docker images
Deeploy allows you to deploy custom Docker images.
With the Deeploy python client CLI you can easily create your own custom Docker images for models, explainers and transformers.
Make sure to follow the Deeploy python client installation instructions and then run the deeploy generate-template --help
command.
The generate-template
command initializes a folder with all files that you need in order to embed your own custom logic whilst adhering to the Deeploy best practices and API spec.
Make sure to follow the steps in the README.md that is located in the created folder.
Reference the Docker image
To deploy a custom Docker image, you need to reference the image in your Repository using a reference.json
file.
This is further explained in Repository Requirements.
This is an example of a reference.json file for a custom Docker image:
# this reference is used in example repository:
# https://gitlab.com/deeploy-ml/sample-models/example-custom-image-hello-world/
{
"reference": {
"docker": {
"image": "deeployml/example-custom-image-hello-world:0.3.0",
"port": 8080
}
}
}
Parameter | Description | Example |
---|---|---|
image | The link to a Docker Image, including the tag | example/image:1.2.3 |
uri (optional) | The URI on which to request predictions | /model:predict |
port | The port number to expose | 8000 |
Adding Docker credentials
If the Docker image requires credentials to access, add the credentials through the Deeploy front-end, as explained in Docker image credentials.
Deploy the custom Docker image
Follow the steps outlined in Creating a Deployment. Make sure to select the custom docker option as your model, explainer or transformer framework.
Absence of entrypoint in your custom Docker images may lead to issues. It is recommended to use ENTRYPOINT
over CMD
in your Dockerfile.
Environment variables
To use environment variables in your images, create an environment variable on the Variables page and select it in the advanced Deployment configuration.