Search code examples
dockerdockerfile

How to use Dockerfile RUN or CMD command to execute the next silent installation


I need to emulate the next Unix command in a Dockerfile:

./DAEJA_VIEWONE_5.0.x_UNIX_ML.bin -i silent -f DAEJA_VIEWONE_silent_install.txt

As you can see is a silent installation for the viewer of Daeja.I think the Dockerfile commands for realize this are RUN or CMD but I can not find an example of how i can achieve this.

I tried to add the next Dockerfile command but it fail:

RUN ./DAEJA_VIEWONE_5.0.x_UNIX_ML.bin -i silent -f DAEJA VIEWONE silent_install.txt

just as @Paolo suggested

I add the Dockerfile and the console error for ilustrative purposes.

enter image description here

The Dockerfile as a text:

FROM alpine:3.14

RUN mkdir /project

COPY DAEJA_VIEWONE_5.0.13_UNIX_ML.bin /project

COPY DAEJA_VIEWONE_silent_install.txt /project

WORKDIR /project

RUN chmod a+x DAEJA_VIEWONE_5.0.13_UNIX_ML.bin

RUN chmod a+x DAEJA_VIEWONE_silent_install.txt

RUN ./DAEJA_VIEWONE_5.0.x_UNIX_ML.bin -i silent -f DAEJA_VIEWONE_silent_install.txt

There is an error in this line, the version number is missing. When that is fixed it starts to work. The version number is 5.0.13 as shown above (copy paste error) RUN ./DAEJA_VIEWONE_5.0.x_UNIX_ML.bin -i silent -f DAEJA_VIEWONE_silent_install.txt

Thanks!


Solution

  • Yes, the right Dockerfile instruction to run something at build time is RUN:

    RUN ./DAEJA_VIEWONE_5.0.x_UNIX_ML.bin -i silent -f DAEJA_VIEWONE_silent_install.txt
    

    obviously assuming that DAEJA_VIEWONE_5.0.x_UNIX_ML.bin is present in the working directory.

    I suggest you review the Dockerfile documentation to understand what each instruction does:

    to sum up, RUN is used at build time to run a command, whereas ENTRYPOINT and CMD define what the container should do when started.