8. FaaS Docker Image¶
Dataloop enables you to deploy in the FaaS module a custom docker image, to enrich your application with literallyanything required for your project. Deploying a docker image is as easy as providing the Docker image path whendeploying the service:
service = package.deploy(service_name='my-service',
runtime=dl.KubernetesRuntime(
runner_image='docker.io/python:3.8'
))
or if you want to update an existing service:
service = dl.services.get('service-id-or-name')
service.runtime.runner_image = 'python:3.8'
service.update()
8.1. Our Docker Image¶
We have our list of docker images publicly available in DockerhubYou can see the env of each docker on the dockerfile here
8.2. Public Docker Images¶
You can use any public docker image, and on runtime, the Dataloop agent will install:
Package requirements
dtlpy package (version as defined on the service)
dtlpy-agent (same version as the SDK)
For example, using docker.io/python:3.9.13
will run the function with Python 3.9.
8.3. Build Your Own Docker Image¶
If you want other environment or need to add some apt-get installation, you can create any docker image and use it directly.You will need to set the HOME directory to /tmp
and install the python packages with –user (or as USER 1000).For instance:
FROM dockerhub.io/dataloopai/dtlpy-agent:latest.gpu.cuda11.5.py3.8.opencv
RUN apt update && apt install -y zip ffmpeg
USER 1000
ENV HOME=/tmp
RUN pip3 install --user \
dtlpy==1.54.10 \
dtlpy-agent==1.54.10 \
torch \
torchvision \
imgaug \
scikit-image==0.17.2
8.4. Using Private Docker Registry¶
To connect a private registry, you’ll need to add the docker container registry credentials as an Organization Secret (ONLY in the UI) and just create use the runner image.