'sdk install groovy' says /bin/sh: sdk: command not found

Hello, I am using the Docker image ubuntu:14.04 provided as official image in docker hub.
I try to make a new image by installing java and groovy using sdk, through a dockerfile.

RUN apt-get -y update && curl -s get.sdkman.io | bash
RUN source "$HOME/.sdkman/bin/sdkman-init.sh
RUN yes | sdk install groovy

but it says- /bin/sh: sdk: command not found. The command ‘/bin/sh -c yes | sdk install groovy’ returned a non-zero code: 127

But if I run the first two lines using dockerfile image is created sucessfully, then if i run the image in interactive mode and execute the third command manually it runs fine.
I examined ~/.bashrc and ~/.profile both has [[ -s “/root/.sdkman/bin/sdkman-init.sh” ]] && source “/root/.sdkman/bin/sdkman-init.sh” at last line.