Absoler
Absoler

Reputation: 1

how to switch the version of ocaml compiler in a docker container without --privilege

Now the version of OCaml compiler in my ubuntu20.04 docker container is 4.08.1, however I need OCaml 3.12.1 to build a project. So I tried opam switch create 3.12.1 and get an error like this:

The compilation of ocaml-base-compiler failed at "/root/.opam/opam-init/hooks/sandbox.sh build ./configure -prefix /root/.opam/3.12.1".

...

bwrap: Creating new namespace failed: Operation not permitted

the docker container is running without --privilege option, I guess this may be the reason. However, I have been using this container for a long time, so it may be diffcult to commit it or migrate its content to another container. Is there any other approach to use a specific-version OCaml compiler?

Upvotes: 0

Views: 182

Answers (1)

octachron
octachron

Reputation: 18902

You can disable sandboxing when initializing opam with

opam init --disable-sandboxing

With this configuration option, opam will not call bubblewrap when building package thus avoiding the issue with nested sandboxing.

Upvotes: 1

Related Questions