How to run jar file using docker file in docker container

后端 未结 3 1054
鱼传尺愫
鱼传尺愫 2021-01-24 06:08

I write the docker file for run the jar file and it does not create the log file for see the console below is my docker file

From ubuntu 
RUN apt-get update &         


        
3条回答
  •  一生所求
    2021-01-24 06:56

    The exec form of CMD doesn't know what redirection is, that's a shell feature.

    Either use stdout for logging.

    CMD ["java","-jar","/real_estate_false.jar"]
    

    If you really need a log file in the container, run the command in a shell

    CMD ["sh", "-c", "java -jar /real_estate_false.jar > var/log/jar.log"]
    CMD java -jar /real_estate_false.jar > var/log/jar.log
    

提交回复
热议问题