Use python API + OTB docker image?

I’m a docker + OTB beginner trying to use the OTB docker image to run OTB (8.1.2) on an M1 mac (macOS 13.4.1) to process my data.

Ideally (if I wasn’t on an M1…) I would write a python script to access my data locally and process it by iterating through my file structure.

I can build the docker image + container, but how should I be using the container now? I’ve seen that I can run OTB CLI commands directly in the container, but I have files to iterate through so I’m not sure if I can do that with the CLI. Can I run python scripts within the container?

Thank you :slight_smile:

Hi @lkillo

yes you can

Hi @remi.cresson, great! can you give any guidance on how to do this specifically for the OTB docker?

thanks very much

I guess you can find plenty of help on this subject, but what you can do is something like

docker run imagename:tag bash -c "otbcli_OpticalCalibration -help && otbcli_Smoothing -help"

you can also mount a script and use it

docker run -v /home/toto/script.py:/script.py imagename:tag python /script.py
docker run -v /home/toto/script.sh:/script.sh imagename:tag bash /script.sh

Thanks, I’ll try these suggestions!