I really hate installing Java on my personal machines, but I still want to develop Scala. Part of the Docker promise is that you develop on the same environment as your production environment. Let’s actually set that up.

Add this alias to your $HOME/.bashrc file. Reload your bashrc, and the sbt command will run the docker image in your current directory.

alias sbt='docker run --rm --tty --interactive --volume "$PWD":/app bigtruedata/sbt'

What if you want to serve html from a random directory? Create another alias for the Apache docker image! This works great for any code coverage libraries that output to html.

alias httpd='docker run --rm --tty --interactive -p 8000:80 --volume "$PWD":/usr/local/apache2/htdocs/ httpd'

Update: It’s a lot easier to start a web server using Python.

# Python 2
python -m SimpleHTTPServer 8000

# Python 3
python -m http.server 8000