Dibyojyoti Sanyal
Dibyojyoti Sanyal

Reputation: 51

not able to install groovy using sdkman in docker image

I use a script to build thee dockerfile. below is my script...

echo "FROM ubuntu:14.04" >> Dockerfile
echo "RUN rm /bin/sh && ln -s /bin/bash /bin/sh" >> Dockerfile
echo "RUN apt-get -y update && apt-get upgrade -y" >> Dockerfile
echo "RUN apt-get install -y software-properties-common" >> Dockerfile
echo "RUN apt-get -y update && add-apt-repository -y ppa:webupd8team/java" >> Dockerfile 
echo "RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections" >> Dockerfile
echo "RUN echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections" >> Dockerfile 
echo "RUN apt-get -y update && apt-get install -y oracle-java8-installer" >> Dockerfile
echo "RUN apt-get install -y curl " >> Dockerfile
echo "RUN apt-get install -y unzip " >> Dockerfile
echo "RUN apt-get -y update && curl -s get.sdkman.io | bash" >> Dockerfile
echo 'RUN source "$HOME/.sdkman/bin/sdkman-init.sh"' >> Dockerfile
echo 'RUN source ~/.profile' >> Dockerfile
echo "RUN yes | sdk install groovy" >> Dockerfile
...
docker build -t imagename:version ./
...

but I get the below error

RUN yes | sdk install groovy
 ---> Running in 09056add5ab7
/bin/sh: sdk: command not found
The command '/bin/sh -c yes | sdk install groovy' returned a non-zero code: 127

if I dont use this command "sdk install groovy" the build is sucessfull. and then i an run the image and issue the same command and it works.

Any help, any idea why this is hapenning?

Upvotes: 2

Views: 3312

Answers (1)

Dibyojyoti Sanyal
Dibyojyoti Sanyal

Reputation: 51

RUN yes | /bin/bash -l -c 'sdk install groovy' 

worked.

Upvotes: 3

Related Questions