Deploy with custom images

Deploying ZenML with custom Docker images.

In most cases, deploying ZenML with the default zenmlhub/zenml-server Docker image should work just fine. However, there are some scenarios when you might need to deploy ZenML with a custom Docker image:

You have implemented a custom artifact store for which you want to enable artifact visualizations or step logs in your dashboard.

You have forked the ZenML repository and want to deploy a ZenML server based on your own fork because you made changes to the server / database logic.

Deploying ZenML with custom Docker images is only possible for Docker or Helm deployments.

Build and Push Custom ZenML Server Docker Image

Here is how you can build a custom ZenML server Docker image:

Set up a container registry of your choice. E.g., as an indivial developer you could create a free Docker Hub account and then set up a free Docker Hub repository.

Clone ZenML (or your ZenML fork) and checkout the branch that you want to deploy, e.g., if you want to deploy ZenML version 0.41.0, runCopygit checkout release/0.41.0

Copy the ZenML base.Dockerfile, e.g.:Copycp docker/base.Dockerfile docker/custom.Dockerfile

Modify the copied Dockerfile:Add additional dependencies:CopyRUN pip install <my_package>(Forks only) install local files instead of official ZenML:CopyRUN pip install -e .[server,secrets-aws,secrets-gcp,secrets-azure,secrets-hashicorp,s3fs,gcsfs,adlfs,connectors-aws,connectors-gcp,connectors-azure]

Build and push an image based on your Dockerfile:Copydocker build -f docker/custom.Dockerfile . -t <YOUR_CONTAINER_REGISTRY>/<IMAGE_NAME>:<IMAGE_TAG> --platform linux/amd64
docker push <YOUR_CONTAINER_REGISTRY>/<IMAGE_NAME>:<IMAGE_TAG>

If you want to verify your custom image locally, you can follow the Deploy a custom ZenML image via Docker section below to deploy the ZenML server locally first.

Deploy ZenML with your custom image