0

I have a very simple Container file to create an image

FROM registry.access.redhat.com/ubi8/ubi:latest

USER root

RUN mkdir /u01/

RUN useradd -ms /bin/bash ofm

RUN echo 'ofm:passwdofm' | chpasswd

RUN chown -R ofm:ofm /u01

USER ofm

RUN mkdir -p /u01/downloads /u01/app

# copy sadeLogger dir from host system to container 
COPY --chown=ofm:ofm  ./sadeLogger /u01/downloads/

# install jdk in the container
RUN /u01/downloads/installOracleJdk.sh /u01/downloads/jdk-8u321-linux-x64.tar.gz

# install my little app in the container
RUN /u01/downloads/sadeLogAgentInstall.sh /u01/downloads/SadeLogAgent.tar

# run my little app in the container 
RUN /u01/app/SadeLogAgent/gosadelogagent.sh &

When I create container from this image, everything works except last step. For some reason it cannot run my app. If I start container in interactive mode I can get into the container and start my application and it works fine. I want my application to run in when I start container in detached mode. Can some help with this? What could be the posible reason that last step does not work?

MTARIQ
  • 63
  • 4
  • Using `&` to background a task in a `RUN` command doesn't make any sense. A `RUN` command executes during the image build process, and is expected to exit. – larsks Apr 27 '22 at 11:11
  • You may be confusing that final `RUN` with `CMD`. See e.g. https://stackoverflow.com/questions/37461868/difference-between-run-and-cmd-in-a-dockerfile – larsks Apr 27 '22 at 12:55

0 Answers0