java - Installing and using Gradle in a docker image/container -


i getting strange error @ end of process of creating docker image dockerfile:

/bin/sh: 1: gradle: not found info[0003] command [/bin/sh -c gradle test jar] returned non-zero code: 127 

the relevant part of dockerfile:

from debian:jessie [...] run curl -l https://services.gradle.org/distributions/gradle-2.4-bin.zip -o gradle-2.4-bin.zip run apt-get install -y unzip run unzip gradle-2.4-bin.zip run echo 'export gradle_home=/app/gradle-2.4' >> $home/.bashrc run echo 'export path=$path:$gradle_home/bin' >> $home/.bashrc run /bin/bash -c "source $home/.bashrc" run gradle test jar [...] 

the command using is: docker build -t java_i .

the strange thing if:

  • i run container 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 log container (command: docker exec -it java_c bash),
  • then manually check gradle environment variables finding them,
  • then manually run commented out command within running container (gradle test jar):

i expected output (the compiled java code in build folder).

i using docker version 1.6.2

this command /bin/bash -c "source $home/.bashrc" means create new non-interactive process , run command in set environment variables there. not affect parent process. variables set, process exits. can check running this:

run /bin/bash -c "source $home/.bashrc; env" run env 

what should working option:

run source ~/.bashrc 

and reason why works when log in, because new process reads updated ~/.bashrc.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -