Docker Community Forums

Share and learn in the Docker community.

Start a jar file whenever I create a container


(bk) #1

Hello ,

whenever I create a container from my image it should execute a jar file. I kept the below command

CMD nohup /app/jdk/jdk1.8.0_66/bin/java -Xms2048m -Xmx2048m -XX:NewSize=384m -XX:MaxNewSize=384m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:ParallelGCThreads=12 -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -verbose:gc -jar /app/web-service.jar $> /log/startup.log 2>&1

But is not executing as expected.

I am unable to find the right syntax to do this . appreciate your help.

(Sam) #2

did u run this from a shell script with CMD?

what is “is not executing as expected”?

(bk) #3

Thanks . I added the CMd in this formaat CMD [“cmd1”,“cmd2”] it worked :slight_smile: