Docker Community Forums

Share and learn in the Docker community.

Docker build Hang


(Walidmansia) #1

Hi
I am trying to build an image that
-> read a Java file
-> Compile It
-> Run It
-> Remove Class file

I dont know why the porcess is blocked when it is in the run phase "RUN java HelloWorld"
the container is still running and impossible for me to stop it, nothing to do to stop it is working
here are the docker file and the java file
the HelloWorld.java was in the same directory than the DockerFile

##Docker File
FROM java:openjdk-7-jdk

ENV MAVEN_VERSION 3.3.9

RUN mkdir -p /usr/share/maven
&& curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz
| tar -xzC /usr/share/maven --strip-components=1
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn

ENV MAVEN_HOME /usr/share/maven

ADD HelloWorld.java /
RUN javac HelloWorld.java
RUN java HelloWorld
RUN rm HelloWorld.class

//Java Hello World

public class HelloWorld {

public static void main(String[] args) {
    // Prints "Hello, World" to the terminal window.
    System.out.println("Hello, World");
}

}


(Walidmansia) #2

resolved
it was because i ma running a VM under mac OS