Dev Container for a learner to get started

OCaml failed to install on my Windows 11 (WSL2) so I tried my old old intel unsupported BigSur where it failed again.
Is there a DevContainer - Docker install somewhere where I can develop inside the docker container ?

If you can provide some details about the issues you ran into, Iā€™m sure you will be able to get some help to get up and running in this forum. WSL2 is a standard platform fully supported by all the OCaml tools, and normally you should not have much trouble getting it to work.

Cheers,
Nicolas

1 Like

I am happy to retry WSL2 - but when I think about it a Dev Container would be more consistent across my Windows 11 box and my old MacBook plus when I get to production it can be once again Docker/Linux. So, is there a DevContainer OCaml anywhere ?

Here is the quick and dirty setup I use:
.devcontainer/Dockerfile

FROM debian:latest
RUN apt-get update && apt-get -y install sudo
RUN useradd -m -s /bin/bash -G sudo anonymous && echo 'anonymous ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER anonymous
WORKDIR /home/anonymous

RUN sudo apt-get install -y --no-install-recommends git opam ca-certificates

RUN opam init -ya --disable-sandboxing

ENV CAML_LD_LIBRARY_PATH=/home/anonymous/.opam/default/lib/stublibs:/home/anonymous/.opam/default/lib/ocaml/stublibs:/home/anonymous/.opam/default/lib/ocaml
ENV OCAML_TOPLEVEL_PATH=/home/anonymous/.opam/default/lib/toplevel
ENV MANPATH=:/home/anonymous/.opam/default/man
ENV OPAM_SWITCH_PREFIX=/home/anonymous/.opam/default
ENV PATH=/home/anonymous/.opam/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

RUN opam install -y ocaml-lsp-server ocamlformat utop

.devcontainer/devcontainer.json

{
    "name": "something",
    "dockerFile": "Dockerfile",
    "customizations": {
        "vscode": {
            "extensions": ["ocamllabs.ocaml-platform"]
        }
    },
    "containerUser": "anonymous",
}

I will give this a go - thanks