This is the repository for the official Docker image for Clojure. It is automatically pulled and built by Stackbrew into the Docker registry. This image runs on OpenJDK 8, 11, and more recent releases and includes Leiningen, boot, and/or tools-deps (see below for tags and building instructions).
Leiningen vs. boot vs. tools-deps
The version tags on these images look like
These refer to which version of leiningen, boot, or tools-deps is packaged in the image (because they can then install
and use any version of Clojure at runtime). The
images will always have a recent version of leiningen installed. If you want boot, specify either
clojure:openjdk-14-boot-N.N.N-slim-bullseye, etc. (where
N.N.N is the version of boot you want installed). If
you want to use tools-deps, specify either
clojure:tools-deps-slim-bullseye or other similar
Note about the latest tag
As of 2020-3-20 the
latest is the default) now has leiningen, boot, and
Previously this tag only had leiningen installed. Installing the others is helpful for quick start examples, newcomers,
etc. as leiningen is by no means the de facto standard build tool these days. The downside is that the image is larger.
But for the
latest tag it's a good trade off because for anything real we have always recommended using more specific
tags. No other tags are affected by this change.
Java has recently introduced a new release cadence of every 6 months and dropped the leading
1 major version number.
As of 2019-9-25, our images will default to the latest LTS release of OpenJDK (currently 11). But we also now provide
the ability to specify which version of Java you'd like via Docker tags:
JDK 1.8 tools-deps image:
JDK 11 variant of that image:
JDK 14 with the latest release of leiningen:
JDK 15 with boot 2.8.3:
The upstream OpenJDK images are built on a few different variants of Debian Linux, so we have exposed those in our Docker tags as well. The default is now Debian slim-bullseye. But you can also specify which distro you'd like by appending it to the end of your Docker tag as in the following examples (but note that not every combination is provided upstream and thus likewise for us):
JDK 1.8 leiningen on Debian slim-bullseye:
JDK 1.8 leiningen on Debian buster:
JDK 11 tools-deps on Debian slim-bullseye:
Sometimes there are upstream openjdk images for early access JDK releases based on Alpine Linux, but they have often later been deprecated once that version is released.
As of 2021-09-08, there are alpine variants only for OpenJDK 18 early access.
Some example tags:
JDK 18 leiningen on Alpine:
JDK 18 tools-deps on Alpine:
These images are based on the Debian buster distribution but have fewer packages installed and are thus much smaller
buster images. Their use is recommended.
Run an interactive shell from this image.
docker run -i -t clojure /bin/bash
Then within the shell, create a new Leiningen project and start a Clojure REPL.
lein new hello-world cd hello-world lein repl
The Dockerfiles are generated by the
docker-clojure Clojure app in this repo.
You'll need the
tools-deps distribution of Clojure installed to run the
build. Often this just means installing the
clojure package for your system.
./build-images.sh script will generate the Dockerfiles and build all of the images.
Note that you'll need to enable the new
buildx feature and set as the default
builder in the Docker daemon you're using to build the images. The build script
uses some flags that require it.
You'll also need to create a builder container with
docker buildx create --use
in order to build images for all supported platforms (currently linux/amd64 and
Read the docs here for more info.
docker-clojure build tool has a test suite that can be run via the