rvs007 Posted March 30, 2023 Share Posted March 30, 2023 I'm asking the question here because I've been trying to create a docker container to run a simple python script and I'm in way over my head. So hopefully someone here can point me in the right direction. A little background... I've migrated from a Windows Server (2012R2) to an Unraid server and have gotten everything set up. I'm now migrating all the little servers/apps that I had running on the Windows Server, one being a little python script called Alarmserver that I have running to allow the Envisalink module attached to my DSC alarm system to talk to a plugin in Homebridge. The server is a bunch of .py files along with a alarmserver.cfg where I've edited with the configuration settings needed for alarmserver to run. I'm trying to move this to Unraid. I want to avoid having to run a Windows VM to run this in a Windows environment. I figure a docker container would be the most efficient way to do this. And I've found numerous docker containers in Docker Hub created by other users for this. But since I already have a folder with the script and a customized configuration file already set up, I'd like to just take that folder and put it in a container and run it, similar to what I'm doing in Windows. c:\python27\python.exe c:\alarmserver\alarmserver.py -c c:\alarmserver\alarmserver.cfg So what's the simplest way to get this into a docker container in Unraid? Thanks in advance. Quote Link to comment
DevanteWeary Posted July 10, 2023 Share Posted July 10, 2023 Hey did you ever figure this out? Trying to do more or less the same as you. Quote Link to comment
Aumoenoav Posted July 17, 2023 Share Posted July 17, 2023 Install python / python3 packages from the app store, install the script package, then you can create a script to run on cron or event Quote Link to comment
primeval_god Posted July 18, 2023 Share Posted July 18, 2023 Depending on what the script needs access to the proper way to do python in unraid is to run it in a docker container. You can either create a custom image with all of your python files included (better if you need to install a bunch of packages link) or use a default container and bind mount in the script directory. The second option might look something like this docker run --rm -it -v /host/scripts:/container/scripts -w /container/scripts python:3.10 python main.py -some-arg 2 Quote Link to comment
Ruato Posted October 1 Share Posted October 1 On 7/18/2023 at 5:49 PM, primeval_god said: Depending on what the script needs access to the proper way to do python in unraid is to run it in a docker container. You can either create a custom image with all of your python files included (better if you need to install a bunch of packages link) or use a default container and bind mount in the script directory. The second option might look something like this docker run --rm -it -v /host/scripts:/container/scripts -w /container/scripts python:3.10 python main.py -some-arg Thank you for good information and help! I need an access to custom network and it does not work if I create a temporary docker container with a docker run command. So, I need to create a custom image. In addition to the generic docker tutorial from the link above, is there a good tutorial that would present the unraid specific details for docker containers? Quote Link to comment
primeval_god Posted Wednesday at 01:24 PM Share Posted Wednesday at 01:24 PM 18 hours ago, Ruato said: I need an access to custom network and it does not work if I create a temporary docker container with a docker run command. A custom docker network? You can specify any existing docker network in your run command. 18 hours ago, Ruato said: In addition to the generic docker tutorial from the link above, is there a good tutorial that would present the unraid specific details for docker containers? I cant think of one off hand. For a python script container I cant think of much unRAID specific stuff to worry about. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.