Add packages to a pre-existing docker image

Last Updated or created 2022-03-20

A little test building a custom docker image, for a friend.

Q: I have a Node-red docker, but without ffmpeg binary

Using below code, i’ve added a overlay with ffmpeg.
Podman command’s should be working for docker command also.
(Note: When adding multiple packages OR other commands, try to use a single commandline, Every RUN command adds a overlay.

mkdir noderedbuild
cd  noderedbuild
vi Dockerfile
FROM nodered/node-red
LABEL description="Custom Nodered Build"
MAINTAINER haanstoot <fash@fash.nu>
USER root
RUN apk add  --no-cache ffmpeg
EXPOSE 1880

Below builds a local image named nodered:v1
NOTE: docker run command may be incomplete for Node-Red, this was just a example to add packages

podman build -t nodered:v1 .    
podman images
docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered localhost/nodered:v1 -d

Tested with

[root@podman ~]# podman exec -it mynodered /bin/bash
bash-5.0# ffmpeg
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers

Usage:

https://flows.nodered.org/flow/127b038961f873d1babeecaf5578959e

RTSP Frame save in Node-Red

Spread the love