I am trying to build my docker image from nodejs minimal as base image.
nodejs minimal does not have shadow-utils which I need to add user group and user.
The nodejs minimal image I am using is hosted in a private repository and this repo does not host the shadow-utils package.
How do I install shadow-utils in the nodejs minimal image via my dockerfile?
I have tried the following in my dockerfile
FROM private.repo.com/node:20.9.0_ubi9
RUN microdnf install shadow-utils -y && \
microdnf clean all
When I run docker build -t myimage:mytag .
it fails saying the following. Not sure if this is a permission issue or a repository issue.
=> ERROR [6/7] RUN microdnf install shadow-utils -y && microdnf clean all 0.4s
------
> [6/7] RUN microdnf install shadow-utils -y && microdnf clean all:
0.289 error: Failed to create: /var/cache/yum/metadata
------
dockerfile:10
--------------------
9 |
10 | >>> RUN microdnf install shadow-utils -y && \
11 | >>> microdnf clean all
12 |
--------------------
ERROR: failed to solve: process "/bin/sh -c microdnf install shadow-utils -y && microdnf clean all" did not complete successfully: exit code: 1
It was a user permissions issue. I added USER root
at the top and it executed the commands with ROOT user and everything worked
USER root
FROM private.repo.com/node:20.9.0_ubi9
RUN microdnf install shadow-utils -y && \
microdnf clean all