Skip to content
Advertisement

Installing and using Gradle in a docker image/container

I am getting this strange error at the end of the process of creating a docker image from a Dockerfile:

JavaScript

The relevant part of the Dockerfile:

JavaScript

The command I am using is: docker build -t java_i .

The strange thing is that if:

  • I run a container from the previous image commenting out RUN gradle test jar (command: docker run -d -p 9093:8080 -p 9094:8081 --name java_c -i -t java_i),
  • then I log into that container (command: docker exec -it java_c bash),
  • then I manually check the gradle environment variables finding them,
  • then I manually run that commented out command from within the running container (gradle test jar):

I eventually get the expected output (the compiled java code in the build folder).

I am using Docker version 1.6.2

Advertisement

Answer

I solved the problem using the ENV docker instructions (link to the documentation).

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement