I have an application that gets deployed from a docker image to a Kubernetes pod. Inside of my docker image I run the following command
FROM openjdk:17.0.1-slim
USER root
WORKDIR /opt/app
ARG JAR_FILE
ARG INFO_APP_BUILD
RUN apt-get update
RUN apt-get install -y sshpass
RUN apt-get install -y openssh-service
COPY /build/libs/*SNAPSHOT.jar /opt/app/app.jar
ENV INFO_APP_BUILD=${INFO_APP_BUILD}
EXPOSE 8080
CMD java -jar /opt/app/app.jar
When the application gets deployed, out of my control, the user gets set to a non root user.
Now the important part is that when i try to launch an ssh command i get an error message no user exists for uid [random id here]
My goal is to configure the docker image to create a user and grant it permission to use the SSH command.