Does anybody ships OCaml software to end users/customers using containers/docker?


Is it easy to ship OCaml software to end users using docker or the like?

I wonder if it is not a better solution than creating self-extracting archives
using opam-bundle.

Especially, I wonder if it would not be faster for end users.
Since installing an opam-bundle is time consuming and not
totally fail-safe (for example because of system dependencies
that need to be installed, but may fail to do so).

Thanks for any feedback on this,

1 Like

I would guess it depends on the end users, esp. of their operating system. I would guess opam is still easier for mac users while docker would be easier for latest windows users.
Also these days I would consider nix, that would work similarly in linux and macos (and not at all on windows).

I do. Though I recently met a lot of various problems considering use of the modern OCaml versions. Gladly, they all are fixed now. I base my containers on a multistage build images, using Alpine Linux, and then copy the statically-built files. To save some precious bytes (and CPU usage) you can also build a static binaries inside these Alpine Linux containers and just copy the resulting binary out of the container. I do so in some cases.

Apart from Nix you might also consider Guix, see for example, their new guix deploy feature.

In some discussion before I wrote a few benefits of Guix compared to Nix:

Do you use guix on top of alpine linux?

This might be off topic, but nevertheless:
We are distributing our OCaml binaries for multiple plattforms (x86_64, armhf, i386) using 0install (which is written in OCaml itself). The installations at the customers keep themselves current automatically, it makes it easy to provide testing packages for development servers, etc.
We are very happy with 0install.


No, these are separate deployment options. Alpine and Guix. Though might be a good idea to try. Alpine has problems with updating their Guile version though.

Thanks for the response! I’m not super interested in distribution, but I’m looking at switching from Nix to Guix for my personal workstation (a remote server I ssh into). I had some issues with GuixSD, so I’m thinking about running Guix on top of a different minimal distro. Any suggestions?