2

I need to install Sdkman in an Alpine based docker image, but there is a problem that default shell is not Bash. Then command:

source "$HOME/.sdkman/bin/sdkman-init.sh"

ends with failure:

/bin/sh: /root/.sdkman/bin/sdkman-init.sh: line 40: SDKMAN_PLATFORM+=64: not found 
marosbfm
  • 311
  • 2
  • 10

1 Answers1

8

You'll need to split the install of SDKMAN and running the init script into two RUN blocks e.g.

RUN apk add bash curl git zip && \
  curl -s "https://get.sdkman.io" | bash
RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk version"

Source: https://e.printstacktrace.blog/using-sdkman-as-a-docker-image-for-jenkins-pipeline-a-step-by-step-guide/

elaver
  • 141
  • 3
  • 3
    You can remove the "git" package if you don't need it for some other reason. The documentation states "You need a basic toolchain including bash, zip, unzip, and curl (tar and gzip required for special cases)". Git is a third option for Windows users. See https://sdkman.io/install. – Brad Rippe Feb 24 '21 at 00:20