I would like to run some python scripts inside of my docker container and inside jupyter environment. Could you tell me please if it’s possible and how to achieve that? An example of Dockerfile piece would be great.
Usually the Jupyter environment includes a full Python environment and so might these resources help?
Or are you trying to trigger running of notebooks?
I saw that. The second link is about running python in cron which doesn’t differ that much from bash.
So let me explain in details:
I would like to use the environment I have when I run my script in cron.
To do that I need to add something to my start.sh script which is actually run when docker starts.
I tried to change it, but it seems to be run with wrong user and doesn’t see my conda packages.
Okay, I see the issue is having cron use the right environment.
You should be able to specify the user when using
docker run so that things would run as the correct user? My concern then would become does that allow you permissions to run what you need?
Actually, docker run with the user runs as sudo, which then executes conda with the right user and correct python paths and so on. I hope I understood that well.
It seems to be quite complicated.
So adding the user to
docker run fixed it?
The trick was to run my python script under sudo (add sudo to cron file). A little bit ugly, but works well.