1

Hi all I’m learning docker using the documentation, I have a situation where I’m stuck, and any help on this would be great.

I have a Computer Vision model which is packaged as a microservice using Azure Functions but the model runs in a GPU machine. I have added the function app image but not sure how to add the Nvidia CUDA image to the dockerfile.

attaching my dockerfile code below

FROM mcr.microsoft.com/azure-functions/python:3.0-python3.8
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

COPY requirements.txt /
RUN python -m venv .venv
RUN . .venv/bin/activate
RUN pip install -r /requirements.txt

COPY . /home/site/wwwroot

Nvidia image which I want to use is the below one

FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04
  • You probably want to use [multi stage builds](https://docs.docker.com/develop/develop-images/multistage-build/). – AymDev Dec 08 '21 at 16:18
  • 1
    Multi-stage builds are intended to build a "tree" of derivative containers (e.g. a base image, a dev image, and a CI image), not to combine different images. – asthasr Dec 08 '21 at 16:23
  • 1
    In general, you can't combine images (_e.g._, [Is there a way to combine Docker images into 1 container?](https://stackoverflow.com/questions/39626579/is-there-a-way-to-combine-docker-images-into-1-container)). There might be a way to get the CUDA support into that specific Azure base image, or conversely to install the Azure prerequisites into the NVidia image, but it probably wouldn't involve using multiple Docker images. – David Maze Dec 08 '21 at 18:01

1 Answers1

1

A Dockerfile is not an execution manifest. If you want to run multiple containers, you need to use a tool like Docker Compose, Kubernetes (overkill), or, given that you have an "Azure functions" container to run, Azure Container Instances.

asthasr
  • 9,125
  • 1
  • 29
  • 43