Get opam in a Docker image

Maybe a silly question, but I would like to get a docker image with opam 2.3.0

The opam docs state for the provided installation script:

Note that this script is intended for end-users, not CI. For that purpose, you can use pre-built Docker images for various configurations.

The image page states:

What’s inside?

Each image contains the following:

  • The latest release of opam

However running:

podman run -it ocaml/opam:debian-12-ocaml-5.2

and opam --version I get 2.0.10

Is there an image I have missed, and if not: Is there a CI specific script for installing a specific version/the latest version of opam, that doesn’t have confirmations etc.?

There are opam-2.3 and similar binaries in /usr/bin. I added this in my Dockerfile:

RUN sudo cp /usr/bin/opam-2.3 /usr/bin/opam

but there are probably cleverer ways to do so.

2 Likes

I think this issue is related: Switching images to opam 2.1 by default · Issue #132 · ocurrent/docker-base-images · GitHub

2 Likes

thanks both, from the git issue - symlinking seems to be the way to go right now:

RUN sudo ln -f /usr/bin/opam-2.3 /usr/bin/opam && opam init --reinit -ni
1 Like