Run NR in Docker Container or Virtual Machine?

Ok, this maybe we’ll trodden ground, but for a while now, I’ve always tried to run the things I need on my NAS, mainly via a container (e.g docker)

But.... a recent flow/dashboard design challenge made me question my Docker approach for hosting NR, as i need to access ffmpeg, which is installed on the host machine) .

What is the ‘best’ way for me to run Node Red ? :thinking:

I appreciate this will be a subjective topic, especially as I had previously run node red solely on a Pi previously, but the benefit of using my NAS as a shared host for all my HA needs, shone through, largely due to my ability to allocate any amount of the host’s quad core cpu and it’s 16gb memory where I felt it was needed.

Given the choice and greater flexibility, is a VM a better way to go ? And if so what virtual OS would be best for NR to be installed on ?

Well if you have such a powerful NAS, I would think that Docker would be the most efficient use of it. Would you really want to run a VM on it? I'd certainly want to check in detail what the peak utilisation currently is before committing to that.

On the other hand, I always think that a VM is actually simpler to use than Docker :slight_smile: But that is mainly due to my lack of experience on Docker. If you are familiar with Docker and happy with its foibles then you should be OK.

If you do go with a VM, then Debian or Ubuntu Server would always be my choice though it depends what you are used to. Debian has the advantage that it is very close to Rasbian on the Pi though Ubuntu Server is very close as well. Either way don't include the desktop as this just wastes resources without adding much.

Thanks @TotallyInformation

While I’ve been using Docker for a while I would not say i’m anywhere near being an expert (novice to intermediate at best).

One of the key limitations I’m noticing is the scope to use the exec node more widely ? As all I have access to (natively) from the command line from within NR seems to be what’s included within the docker container ; or what’s available via Node Red application to install. Hence my ffmpeg complexity/conundrum at the moment.

Looking at my QNAP NAS - it has a number of options I could use , the following are their own branded/application interfaces.

Container Station - e.g Docker, LXC
Virtualisation Station - e.g Windows, Android, Linux OS
Linux Station - e.g full Linux builds

Having the bare bones Debian OS (and an experience like the Pi, ) could be the way to go; i’ll Look into that.

You could of course rebuild your docker container to include the apps you need. Copy the existing dockerfile and add necessary lines to install the apps then rebuild it.

And you could create TCP or UDP ports to the "outside" world.

But that is what I mean about it being more bother than worth. Is it really worthwhile to mess with all of that for a single instance? Not convinced personally though I would guess that if I worked with Docker regularly, it wouldn't be an issue so much.

Most efficient way would be Docker, you can build the desired container with FFMPEG included, give it access to it on the host via a host volume or (with caution due to future depreciation) create a separate FFMPEG container and use legacy linking to give it access.
Given it's on a NAS so space isn't much of an issue I would choose the first option and just have it included in the container. Host volume could cause problems if an upgrade changes the version and breaks something in your container and legacy linking will eventually be depreciated.

I use docker for all devices that do not need PHYSICAL access to the outside world and then Virtual Machines If i possibly need to pass through physical devices etc (obviously the line blurs a little here)

I personally run my NR instances in multiple virtual machines under VMware - i have a number of hosts that operate in a cluster at home and enable me to utilise shared storage and to then use snapshots and the like prior to performing any sort of upgrades - i find this peace of mind is worth the additional small overhead that is incurred from running NR natively on the hardware.


1 Like

Haha, 10-out-of-10 for the most complex solution :smile:

While I agree, using a Docker instance is the best solution, being able to access other elements/programs etc. outside of the container is the main limitation. And where possible I'd prefer to follow the official releases of the NR team, rather than constructing my own each time.

Looking within the NR application/node Pallette, there are already a few in there that reference ffmpeg, but they seem specialist in their design/use - which makes me wonder.....

Is there a way that NR can be used (e.g like via the Pallette) as the vehicle to install a local program inside the docker container that can then be called using a command line via the Exec node?

No need for a special Node or flow/UI process to be created, I just need the app installed and accessible ?

Just found this, could it be an option ? ...

This guidance sadly looks like it's at an "Advanced Docker Skills" level; which I sadly lack. Any thoughts/suggestions - previous experience out there ?

If you wish to persist with the Docker path then you should really have a seperate docker container for ffmpeg and then communicate between the two containers as required.

I am sure there would be plenty of containers out there purpose built with ffmpeg in there - what exactly are you trying to achieve ?


This one has 10m pulls so is probably going to cover almost every scenario you can imagne


Sorry if that's not been clear above, I'm ultimately looking to make use of ffmpeg with the exec node of my NR docker instance - However - the overall principle of accessing other apps/services locally (that are not available via the pallette or part of the Docker instance ) applies here too.


I already have it installed on the host, and have looked at it as a seperate docker too, - see comment moments earlier for desirable/ideal solution - if that helps..

Yep - but what is the overall solution ? i,e, what are you trying to do with FFMPEG - re-encode a video stream convert a static file and post somewhere etc etc


This came about as part of this thread (VLC video on dashboard), if you are interested in the history - but it's grown sightly since, looking more at how to access more when using NR Docker

OK got it now - did not tie the two together.

My advice would be to take a step back, bult NR in a virtual machine so you can install all the ffmpeg stuff you need, get your dashboard working and understand what all the dependencies etc are. then work out if it is worth doing as a docker (or number of ) containers.

You are trying to achieve quite a complex end result with many technical limiitaton (apple rendering of html video etc) and would suggest simplifiying as much of the solution as possilbe initially

I would build the solution on a Ubuntu VM - asuming you have a PC - then i would use vmware workstation for this - if you do not have access to that then i would bnext go for Hyper v on windows 10 (assuming you are using a windows 10 PC)


My 2 cents; deploy VM; headless debian or ubuntu server and call it a day, gives all the flexibility you need, also future proof.

I agree - and I had tried to do that the other day, but everything I tried to do/run from the command line could not be found. The repositories list did not look correct, I could not get any SSH access (only via the VM console) and I could not install anything - no text editors like vi, vim, nano ! And then it wanted keys to do something - taking me way out of my knowledge level..

I ended up wasting so much time trying to get that to work :frowning:

Pehaps I'll give it another go...

Just to put this one to bed - I take it this is not an option, no way to wrap the install for use in the NR container .. ?

Just curious how the existing NR add-on's that provide ffmpeg capabilities have done it ?