Introducing our new CEO Don Johnson - Read More

ocaml/opam

Sponsored OSS

By ocaml

Updated about 2 hours ago

The OCaml opam package manager images

Image
Languages & Frameworks
Integration & Delivery
21

1M+

OCaml Docker Base Images

Latest docker base-images with opam pre-installed along with a specific OCaml compiler version.

💡 The following repositories are no longer updated:ocaml/opam2, ocaml/opam2-staging, ocurrent/opam and ocaml/ocaml. To get the latest and greatest images use this repository (ocaml/opam).

The base-images are updated weekly using an OCurrentpipeline. The pipeline has a web interface which also displays the build logs for each container.

💡 These images are primary intended for OCaml's Continuous Testing systems, and can be a little quirky to use as development images. However, please do ask questions both on OCaml's Discuss forum and on the docker-base-images issue tracker).

Tag Format

The images are tagged in a specific format, the most verbose of which contains the OCaml version and the distribution version such as ocaml/opam:debian-10-ocaml-4.12.

All other tags are aliases to the latest version of a distribution and/or the OCaml compiler. For example if the latest Debian is version 11 and the latest OCaml is 4.13 then ocaml/opam:debian is an alias of ocaml/opam:debian-11-ocaml-4.13. The OCaml version will always point to the latest patch version, so 4.11 will be 4.11.X for the greatest X that is released. There are also some alternate OCaml configurations such as with flambda enabled or with frame pointers enabled.

Arch Linux is a rolling release, so there is just the archlinux and no archlinux-version tag. The ubuntu tag is always the latest release of Ubuntu. ubuntu-lts is always the most recent LTS release. Windows is available in two flavours: windows-mingw- has the MinGW-w64 native Windows port installed and windows-msvc has the Microsoft Visual Studio port enabled.

The base-images pipeline uses ocaml-version and ocaml-dockerfile at particular commits to generate the tag names. You can use these libraries too if you are automating some process that requires base-image tag names in OCaml.

All of the tags are available on docker-hub. Also note, the images are multi-arch images including support for 32 and 64 bit where possible and arm, x86 and ppc.

The latest tag is the latest release of OCaml running on the latest version of Debian (Debian is used as it has the widest architecture support for OCaml).

The archive tag contains a snapshot of all the source archives for opam-repository generated by opam admin cache in /cache and can be used to set-up a local archive cache.

What's inside?

Each image contains the following:

  • The latest release of opam
  • A global opam switch with the base-image-specific compiler pre-installed
  • A local opam-repository from when the base-image was created
  • A default user called opam

The last point is important. If you use the base-images as a base to build upon in a Dockerfile (i.e. FROM ocaml/opam...) this will be run as the opam user. This can cause permission errors if you try to build somewhere that needs root access. You can either change the user to root before building anything or ensure you build somewhere you have access to such as /home/opam. This can also catch you out when copying files and directories into the image. If you need the opam user to have access to them be sure to COPY --chown=opam <SRCs> <DST>.

Usage

The base-images are used in lots of other OCaml projects including ocaml-ci, opam-repo-ci and opam-health-check. Quite often you will see them as the sha256 hash which points to a specific image (maybe not the latest). This is particularly useful in applications like ocaml-ci for users to reproduce the build if it's failing.

Docker Pull Command

docker pull ocaml/opam