Docker container gives me a hard time

I’m trying to make an intent “GetLatestNews” (be it in Dutch) using this command:
/usr/bin/mpg321 http://progressive-audio.lwc.vrtcdn.be/content/fixed/11_11niws-snip_lo.mp3

I thought it would be just a matter of putting this command in an exec-node in node-red. But things don’t work out as expected.
I get this error message:

code: 127
message: “Command failed: /usr/bin/mpg321 http://progressive-audio.lwc.vrtcdn.be/content/fixed/11_11niws-snip_lo.mp3↵/bin/bash: /usr/bin/mpg321: No such file or directory↵”

I think this has to do with having installed node-red (and rhasspy) using docker. Unfortunately I have no idea how to solve this properly (I could of course reinstall everything without docker but then of course I lose the advantages of a docker system). I am also puzzled by the fact that node-red is able to play
the mp3 using a gui-widget. Here is my node-red flow so you can see what I mean.

https://www.dropbox.com/s/iuhyyleza17506y/jongstenieuws.json?dl=1

kind regards,
hugo

Yes mpg321 may be on your host system, but is not available in the container. I don’t think the Node-RED Docker image is set up to install your own software in. It’s better to search for a node that does what you want.

There is a official way to customize nodered with software and so on but I found it hard to use because it is based on alpine. I solved that for me by making my own dockerfile for it that more or less mirrors what they do on alpine. So it is possible to somewhat easily install extra software on nodered, but only because their dockerfile is pretty simple in what it does, just creates a user and then uses node to install nodered.

If you are using Home Assistant you can install the Node Red addon.
There is a config system_packages, which can be used to install additional packages

If you really want to run your Node-RED container with mpg321 installed in it, you can build your own Node-RED image:

In the file scripts/install_devtools.sh change the following line:

  apk add --no-cache --virtual devtools build-base linux-headers udev python python3

to:

  apk add --no-cache --virtual devtools build-base linux-headers udev python python3 mpg321

And then build the image as explained in the README. Now you can use your own custom Node-RED image in your Docker Compose file if you refer to the image and tag name you supplied while building the image.

Note that you’re now responsible yourself for rebuilding the image when Node-RED publishes a new version.

Thanks for the info, but I think this might be one risky step too far for just wanting to play an mp3-file located on the Internet (on my raspberry with Rhasspy+node-red in containers). If it only could be done with merely a regular node-red flow…

thanks for all the help
hugo