0

I have build the docker container from based dockerfile of Openvino 2021.4_dev. Additionally add some library need to run my python script which is top on based Openvino dockerfile.

Acceptation was when I run the container it's should start runing python script.

ENTRYPOINT ["python3","-U","main.py"]

But seem that some library doesnot found as I forget to source setupvar.sh

So I tried with RUN,shell and directly , it is not working. With shell option container started with stuck at setupvar.sh message.

I have observed one thing that whatever shell are using for python script running ,setupvar.sh should source on same shell. But as docker each CMD ,SHELL Or ENTRYPOINT executed with seperate shell on call.

How can I resolved the problem ? How can I source setupvar.sh and script on same shell so script should run once container started.

Note:I don't want it interactive solution that's not requirment as everything run as container started

2 Answers2

0

I have resolved issue by creating separate shell script and run it from docker file which first execute setupar.sh in bash shell and then run python script on same shell

shell script: run.sh

#!/bin/bash

source /opt/intel/openvino_2021/bin/setupvars.sh
exec /usr/bin/python3 -u "/app/main.py"

add end of docker file:

ENTRYPOINT ["/app/run.sh" ]
pppery
  • 3,731
  • 22
  • 33
  • 46
0

You can permanently set the environment variables as shown in Set Environment Variable. Every time the new terminal is opened, it will automatically set the environment variable.

Rommel_Intel
  • 1,369
  • 1
  • 4
  • 8