Hello Flyte Team! I want to use custom built docke...
# ask-the-community
s
Hello Flyte Team! I want to use custom built docker image to use our custom dependencies. I tested on flyte sandbox on my local macbook. (Running from
flytectl demo start
) My workflow was successfully run on local (
pyflyte run cifar10.py wf
) But my workflow needs
torch
packages, so I built docker image with Dockerfile like below:
Copy code
FROM python:3.9-slim-buster

RUN python -m pip install torch torchvision

RUN python -m pip install flytekit pandas numpy awscli
I pushed the image to dockerhub, it can be accessed publicly. And I submit flyte workflow with
pyflyte
cli
pyflyte run --remote --image {username}/flyte:0.0.4 cifar10.py wf
But it doesn’t work on remote (sandbox). How can I do?
f
Hey Seung-Woo, can you please test this to see whether it is a flyte or a kubernetes problem?
Copy code
kubectl run  -i --tty --rm test --pod-running-timeout=20m0s --image={username}/flyte:0.0.4 --restart=Never -- bash
If this pod starts and gives you a shell, kubernetes can pull the image. If this doesn’t start, can you please post the events at the bottom of
kubectl describe pod test
?
s
I got my code error. i missed to add /root to PYTHONPATH env variable. After setting it, it works!
f
Perfect 🙂
s
Should I add /root to PYTHONPATH and copy my python file to /root?
or just adding /root to PYTHONPATH is enough?
k
adding /root to PYTHONPATH is enough, and you should copy python file to
WORKDIR
Copy code
WORKDIR /tmp
COPY python_file /tmp
typically, we’ll copy to /root
s
Originally I put the file(e.g.
train.py
) to docker image, i run workflow with
pyflyte run --remote --image {image_name} train.py wf
. It seems that the change of file (
train.py
) affected without rebuild the image. Is it intended?
s
Yes, it is.
pyflyte run
does fast registration. So you need not include code in your Docker image.
109 Views