# Dev Container for a learner to get started

**URL:** <https://discuss.ocaml.org/t/dev-container-for-a-learner-to-get-started/14534>\
**Category:** Learning\
**Created:** [April 22, 2024, 11:37am UTC](https://discuss.ocaml.org/t/dev-container-for-a-learner-to-get-started/14534 "2024-04-22T11:37:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chriss](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@chriss](https://discuss.ocaml.org/u/chriss)\
**Post date:** [April 22, 2024, 11:37am UTC](https://discuss.ocaml.org/t/dev-container-for-a-learner-to-get-started/14534/1 "2024-04-22T11:37:34Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![nojb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/nojb/32/519_2.png) [@nojb](https://discuss.ocaml.org/u/nojb)\
**Post date:** [April 22, 2024, 11:47am UTC](https://discuss.ocaml.org/t/dev-container-for-a-learner-to-get-started/14534/2 "2024-04-22T11:47:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chriss](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@chriss](https://discuss.ocaml.org/u/chriss)\
**Post date:** [April 22, 2024, 12:50pm UTC](https://discuss.ocaml.org/t/dev-container-for-a-learner-to-get-started/14534/3 "2024-04-22T12:50:06Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![cuihtlauac](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/cuihtlauac/32/3638_2.png) [@cuihtlauac](https://discuss.ocaml.org/u/cuihtlauac)\
**Post date:** [April 22, 2024, 12:59pm UTC](https://discuss.ocaml.org/t/dev-container-for-a-learner-to-get-started/14534/4 "2024-04-22T12:59:53Z")

</div>

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

```auto
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`**

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

```

---

<div class="post-metadata">

**Author:** ![chriss](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@chriss](https://discuss.ocaml.org/u/chriss)\
**Post date:** [April 22, 2024, 1:53pm UTC](https://discuss.ocaml.org/t/dev-container-for-a-learner-to-get-started/14534/6 "2024-04-22T13:53:36Z")

</div>

I will give this a go - thanks
