Search code examples
dockerdocker-composelame

How do I use an Ubuntu packgage with software running insde docker?


I have a node.JS app with a MYSQL database inside a docker container to make it scale easily but I've ran into an issue.

I am using a packgage called node-lame. It uses the lame software in order to edit mp3 files inside my app. The problem is that the lame packgage is installed on my system while the app is inside the contaier.

When I try to use node lame it returns an error meaning lame isn't installed - it probably cant use packgages on the machine inside docker.

How do I pass/make lame on the machine accessible to the app inside a container or install only one single ubuntu packgage in the container?

(I don't want to run a whole version of Ubuntu inside docker just to have this one functionality)


Solution

  • You can't use software on the host from inside the container. So you need to have node-lame inside the container.

    Add node-lame as a dependency in your package.json file and it'll be installed when your Dockerfile does RUN npm install.

    To install lame, add the following line to your Dockerfile

    RUN apt update && apt install -y lame