1

I do not have much knowledge on docker file. Please help me with below requirement.

I am looking for a docker RUN command as below:

RUN set -ex && \
    yum install -y tar gzip && \
    <Other set of commands which includes mkdir, curl, tar>
    rm -vr properties  && \
    if [${arg} == "prod"] then  rm -v conf/args.properties fi 

This is not working and getting error syntax error: unexpected end of file

2
  • Something you could try is to have your commands on a separate script file and the run that from your dockerfile. I think that'd make more manageable, IMO. That said, you'd loose having it all in the dockerfile Commented Nov 17, 2020 at 6:28
  • Thank u for your reply. I am wondering what is the wrong in this syntax or how to write this..? Commented Nov 17, 2020 at 6:46

1 Answer 1

7

It seems to me, that you have missed one or two ;

If statements in shell need to have a ; after the condition if the then is in the same line.

I have added a second ; after the rm statement before fi.


Your code should look like

RUN set -ex && \
    yum install -y tar gzip && \
    <Other set of commands which includes mkdir, curl, tar>
    rm -vr properties  && \
    if [ ${arg} == "prod" ]; then  rm -v conf/args.properties; fi
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.