Making a change to an image or video file using FFMPEG 2 – Lions, Tigers, and Containers – Oh My! Podman and Friends
Once NPM completes the build, you’ll find your application binaries inside a directory called ./build on your host machine
But wait, just as I mentioned earlier, there is more than one way to skin a cat. A more elegant way to achieve the same thing might be to instead tell Podman where you want the working directory to be. If we do this, we don’t even need to set bash as our entry point – instead, we can jump straight into npm. This can be done with the -w (or –workdir) command, like so:
$ podman run –rm -v $(pwd):/app –workdir /app –entrypoint npm node run build
In my opinion, the second approach is cleaner, but the end result is the same.
Running a lightweight NGINX web server to preview a web page locally
In this example, we might as well continue from the last exercise, where we built a Node.js application. Now that we have our Node .js application built/compiled, let’s host it inside an NGINX container. We can do this by simply mounting the build directory into the /user/share/nginx/html directory inside the NGINX container.
How did I know to host it inside this specific directory? In this case, I had to read up on the NGINX documentation for the NGINX container. You can usually find this type of documentation on any container registry that hosts the container you’re looking to run.
The command to host our build directory locally is the following:
$ podman run –rm –name ol8cookbook -p 80:80 -v ${pwd}/build:/usr/share/nginx/html:ro -d nginx
With Podman, the default setting for rootless ports cannot expose privileged port 80. If you have not changed this setting, you will see a message such as this:
Error: rootlessport cannot expose privileged port 80, you can add ‘net.ipv4.ip_unprivileged_port_start=80’ to /etc/sysctl.conf (currently 1024), or choose a larger port number (>= 1024): listen tcp 0.0.0.0:80: bind: permission denied
You can override this setting if you have root privileges, with the following:
$ sudo sysctl net.ipv4.ip_unprivileged_port_start=80
Alternatively, you can simply choose to use a port number of 1024 or higher. Once you have the container running, you can preview the local website by navigating to http://localhost (if you’re using port 80) or http://localhost:8080 (or whatever port that you assigned if you did not go with port 80).