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 && \
apt-get upgrade -y && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:webupd8team/java -y && \
apt-get update && \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections && \
apt-get install -y oracle-java8-installer && \
apt-get clean
VOLUME /temp
RUN apt-get install -y vim
ADD real_estate_false.jar /real_estate_false.jar
COPY real_estate_false_lib /real_estate_false_lib
COPY resources /resources
COPY testxml /testxml
CMD ["java","-jar","/real_estate_false.jar",">","var/log/jar.log"]
Why are you creating a logging file inside the container? Configuring a logging driver would be more flexible.
The following example is contrived, but demonstrates how logging events from all your containers could be collected. I suggest reading further into the options available from fluentd
Example
First run fluentd within a container to collect log events
Now run a container that creates an event to be logged:
The sample configuration sends log events to an output log file
log.conf
Additional
Are you married to the Oracle JDK? The following Dockerfile would be considerable simpler:
To just run myapp.jar in docker (e.g. to avoid installing java on the host) you can just run:
The exec form of
CMD
doesn't know what redirection is, that's a shell feature.Either use stdout for logging.
If you really need a log file in the container, run the command in a shell