Home > Software design >  Moving over to red hat ubi-minimal
Moving over to red hat ubi-minimal

Time:06-18

Bit of a newb question. I'm currently running off Red Hat UBI 8 and am looking to move to Red Hat 8 UBI-Minimal.

My current docker file has something like this in it:

RUN groupadd -r -g 1000 myuser \
  && useradd -r -u 1000 -g myuser -m -d /opt/myuser -s /bin/bash myuser
RUN mkdir /deployments \
  && chmod 755 /deployments \
  && chown -R myuser /deployments

I was looking into this more and at first i thought ubi-minimal might be a "rootless" container but a simple test i ran on my local shows otherwise:

docker run -p 8080:8080 -it myreg/redhat/ubi8/ubi-minimal

enter image description here

That means I should be looking to replicate the above lines against ubi-minimal but it seems like groupadd & useradd don't exist in that image. How can i replicate docker file lines the above for the ubi-minimal image?

CodePudding user response:

You can add the groupadd and useradd commands by installing the shadow-utils package like this

FROM registry.access.redhat.com/ubi8/ubi-minimal
RUN microdnf install shadow-utils
RUN groupadd -r -g 1000 myuser \
  && useradd -r -u 1000 -g myuser -m -d /opt/myuser -s /bin/bash myuser
RUN mkdir /deployments \
  && chmod 755 /deployments \
  && chown -R myuser /deployments
  • Related