Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown Instruction ln Docker File in RUN

Hi Here is my Docker File. I getting an Error while Installing Maven it's not able to find "ln -s" Soft Link Command. Please Help me with this.

# We first will give the base image details for the tag "FROM" OS:Version
FROM centos:latest
#who will maintain the image 
MAINTAINER XYZ <[email protected]>


RUN yum install -y httpd curl sed grep egrep fgrep wget git net-tools zip unzip which source openssh-server

#JAVA INSTALLATION
ADD http://www.mediafire.com/file/177sevky311fbdh/jdk-8u144-linux-x64.rpm / 
RUN rpm -ivh jdk-8u144-linux-x64.rpm 
ENV JAVA_HOME="/usr/java/jdk1.8.0_144"  
ENV JRE_HOME="/usr/java/jdk1.8.0_144/jre"

#MAVEN INSTALLATION
ADD https://www.mediafire.com/folder/6b0t6el85gtof/maven /
RUN mv /maven /opt/maven
    ln -s /opt/maven/bin/mvn /usr/bin/mvn && \
    wget http://www.mediafire.com/file/gpg2arhygj0a0wy/maven.sh && \
    mv /maven.sh /etc/profile.d && \
    chmod 755 /etc/profile.d/maven.sh


RUN cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original && \
    chmod a-w /etc/ssh/sshd_config.original && \
    mkdir /var/run/sshd && \
    echo 'root:screencast' | chpasswd && \
    sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

CMD ["/usr/sbin/sshd, "-D"]
EXPOSE 22 
like image 774
Pavan Yalamanchili Avatar asked Sep 23 '17 19:09

Pavan Yalamanchili


1 Answers

You need to add an &&\ to link RUN commands togethers

Otherwise Dockerfile won't be able to interpret ln as a Dockerfile command (like RUN, COPY, ADD, ...)

RUN mv /maven /opt/maven &&\    <============== missing
    ln -s /opt/maven/bin/mvn /usr/bin/mvn && \

Or at least add a second run

RUN mv /maven /opt/maven 
RUN ln -s /opt/maven/bin/mvn /usr/bin/mvn && \
 ^  ...
 |
 --- missing
like image 134
VonC Avatar answered Sep 28 '22 07:09

VonC