ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 #This can vary ENV PATH $PATH:$JAVA_HOME/bin And build the docker image with --no-cache option