Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simplest way to run python script in Unraid

Featured Replies

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.

  • 3 months later...

Hey did you ever figure this out? Trying to do more or less the same as you.

Install python / python3 packages from the app store, install the script package, then you can create a script to run on cron or event

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

 

  • 1 year later...
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? 

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. 

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.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.