Docker Community Forums

Share and learn in the Docker community.

Docker exited with code 1

Hi all, I am using docker to run my Clojure project locally but unfortunately when I run the command docker run -it --rm --name my-running-app clojure-app the container runs for approximatively 1 min and stopped after that. I can see some WARN from my project which I believe is not the issue there when I run docker logs command.

The warnings are as follows:

WARN [dependency] - Unable to open requested logfile (/tmp/app.log) --- opening /tmp/uservice.log instead.

[main] WARN carica.core - (:value-in-dollar) isn't a valid config

My DockerFile:

FROM clojure:openjdk-8-lein-2.9.6

RUN mkdir -p /usr/src/app

WORKDIR /usr/src/app

COPY project.clj /usr/src/app/

RUN lein deps

COPY . /usr/src/app

RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar

CMD ["java", "-jar", "app-standalone.jar"]

Please note that I am fairly new to docker. Also, my apologies if this post is duplicated, but other online resources were not much of a help for me.

Aside from docker logs, are there any commands (Perhaps other logs) that will be helpful to understand the issue there?

There is a exit code 1: EXITED (1)

Again, I am unsure if the docker logs command is enough there to view logs and I am looking for other logs alternatives to understand the issue.

Thank you in advance for your help.

Since your image seem to only leverage the CMD and no entrypoint, you can try to start the container with overrinding the CMD itself.

Use a command like this to start the container and just enter an interactive terminal inside (without starting the java app itself):

docker run -ti --rm ${image} /bin/bash # if /bin/bash not available try /bin/sh

Then start your application with java -jar app-stanadlone.jar, if it exits check the logs.

It realy depends on whether you configure your logging framework to log everything to the console, or write it into a file. Of course docker logs won’t include what you write into a file. The recommended approach is to redirect the log stream to console. Before you ask: I have no idea what logging framework your application uses or how to configure it, though as a developer you should know that :slight_smile:

1 Like

Hi Meyay, thank you for your help! I have been able to identify the errors through your suggested commands.