stuck at command “sbt compile” in docker ubuntu

I try to include sbt into docker images. However, it never works and always stuck at Getting org.scala-sbt sbt 0.13.7 ... Also, it is also not working for changing the sbt version.

Here is the snippet of docker file

  • Docker intermittently failing when building image
  • How to disable OpenSSL version verification
  • Kubeadm + flannel , service not accessable
  • Can't connect to database with docker-compose with mysql and php 7
  • Wasabi API over HTTPS instead of HTTP
  • Not able to run tomcat container in kubernetes after exposing it as a service
  • FROM ubuntu:14.04

    RUN echo "deb /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
    RUN sudo apt-get update
    RUN sudo apt-get install sbt //also I used force--yes

    also, I try to install it on the container manually by using

    sudo apt-get update
    sudo dpkg -i sbt-0.13.5.deb

    When I run sbt compile, it also stuck trying to get Getting org.scala-sbt ...

    but it is working for sbt --version

    Basically, I dont know why sbt stucks trying to get Getting org.scala-sbt ...

  • Change DigitalOcean access token for docker-machine
  • how to use docker-compose and maven snaphot dependencies from external repos
  • fail to access mysql via docker link
  • Docker Volume Containers for database, logs and metrics
  • Isolate PHP applications with Docker
  • DownGrade ASP Core Docker supported Project
  • 3 Solutions collect form web for “stuck at command “sbt compile” in docker ubuntu”

    You will need a Java Virtual Machine for SBT and so I think it’s a good think you start from the java official docker image. Here is a basic docker file that uses the official ubuntu installation method:

    FROM java
    RUN echo "deb /" | tee -a /etc/apt/sources.list.d/sbt.list
    RUN apt-key update
    RUN apt-get update
    RUN apt-get -y --force-yes install sbt

    NOTE: --force-yes has to be there because it is not an authenticated package. I tried adding RUN apt-key update, but that didn’t make a difference so you can omit this line.

    Then, build a test image: docker build -t test/sbt ., create an interactive container docker run -i -t test/sbt sbt and play with it.

    This works for me, but I noticed the download times were slow for launching SBT, so be patient at this step.

    This is because the SBT executable in itself is really light and will fetch a bunch of libraries on the first run to accomplish its task. It’s also a way for SBT to support multiple projects using multiple SBT versions. If you are stuck at libraries resolution, check your networking configuration. For SBT errors, they are mostly printed on the command line, but you can configure logging if you want.

    What’s left for you to figure out is to add your project files and issue a compile command to test it.

    sbt will try to download a higher version of itself if the project require a higher version than the currently installed sbt version. Usually there is a {projectFolder}/project/ which specifies the desired sbt version for a sbt project. for example: sbt.version=0.13.7 requires version 0.13.7

    You seem to get stuck at Getting org.scala-sbt sbt 0.13.7 .... But I believe sbt is actually trying to download sbt 0.13.7 to your local. As the package is not small, depending on your network speed, it may take a while.

    It is also likely that there is a network connectivity issue that prevents sbt from downloading its package. So you can try to verify first your network connectivity is not a problem.

    If your network is fine, another approach you can try is to go to sbt site to download 0.13.7 package manually to your docker and install it there by following instructions you can find from sbt site.

    Hope this helps.

    Sometimes sbt stuck when downloading files. You can periodically check size ~/.ivy2 folder and if size isn’t grow kick sbt process and rerun sbt.

    For me only after 5 kicks sbt download all files!!!

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.