Estimated reading time: 4 minutes

Haskell is an advanced purely-functional programming language.

GitHub repo: https://github.com/freebroccolo/docker-haskell

Library reference

This content is imported from the official Docker Library docs, and is provided by the original uploader. You can view the Docker Store page for this image at https://store.docker.com/images/haskell

Supported tags and respective Dockerfile links

Quick reference

What is Haskell?

Haskell is a lazy, functional, statically-typed programming language with advanced type system features such as higher-rank, higher-kinded parametric polymorphism, monadic effects, generalized algebraic data types (GADTs), flexible type classes, associated type families, and more.

Haskell’s ghc is a portable, optimizing compiler with a foreign-function interface (FFI), an LLVM backend, and sophisticated runtime support for concurrency, explicit/implicit parallelism, runtime profiling, etc. Other Haskell tools like criterion, quickcheck, hpc, and haddock provide advanced benchmarking, property-based testing, code coverage, and documentation generation.

A large number of production-quality Haskell libraries are available from Hackage in the form of Cabal packages. The traditional cabal tool, or the more recent stack tool (available in 7.10.3+) can be used to streamline working with Cabal packages. The key differences are summarized here. New users are encouraged to start with stack.


About this image

This image ships a minimal Haskell toolchain with the following packages from the hvr PPA:

  • ghc
  • alex
  • cabal-install
  • happy

As of 7.10.3, the stack tool is included.

Note: The GHC developers do not support legacy release branches (i.e. 7.8.x). While older GHC release tags are available in this DockerHub repository, only the latest stable release (or upcoming release candidates) will be shown in the “Supported tags ...” section at the top of this page.

How to use this image

Start an interactive interpreter session with ghci:

$ docker run -it --rm haskell:8
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help

Dockerize an application from Hackage with a Dockerfile:

FROM haskell:8
RUN stack install pandoc pandoc-citeproc
ENTRYPOINT ["pandoc"]

Alternatively, using cabal:

FROM haskell:8
RUN cabal update && cabal install pandoc pandoc-citeproc
ENTRYPOINT ["pandoc"]

Iteratively develop a Haskell application with a Dockerfile utilizing the build cache:

FROM haskell:7.10

WORKDIR /opt/server

RUN cabal update

# Add just the .cabal file to capture dependencies
COPY ./snap-example.cabal /opt/server/snap-example.cabal

# Docker will cache this command as a layer, freeing us up to
# modify source code without re-installing dependencies
# (unless the .cabal file changes!)
RUN cabal install --only-dependencies -j4

# Add and Install Application Code
COPY . /opt/server
RUN cabal install

CMD ["snap-example"]


See the application snippet above in more detail in the example snap application.


This image is licensed under the MIT License (see LICENSE), and includes software licensed under the Glasgow Haskell Compiler License (BSD-style).

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

Some additional license information which was able to be auto-detected might be found in the repo-info repository’s haskell/ directory.

As for any pre-built image usage, it is the image user’s responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

library, sample, haskell