0

I am using docker to run sbt tests in a container. The dockerfile ends with the line (i tried every 3 of them):

#CMD ["sbt", "project myproject", "it:test"]
#CMD sbt "project myproject" it:test 2>&1
CMD ["sh", "-c", "sbt \"project myproject\" it:test"]

I then build the image with

 docker build -f ci-cd/ci-env/Dockerfile -t docker_test:v1 .

When I run the container with

docker run docker_test:v1

I don't see any output after the first 3 lines. Connecting to container's shell tells me that the tests are indeed run but the output is suppressed - I can see only 3 lines instead of the full sbt output:

[info] Loading settings for project my-build from plugins.sbt ...
[info] Loading project definition from /my/project
[info] Updating ProjectRef(uri("file:/my/project/"), "my-build")...

I can only get the output when using

docker run -it docker_test:v1

but -it can't be used in Jenkins.

How do I get the output of sbt test in Docker?

Kal-ko
  • 317
  • 1
  • 10

0 Answers0