[opam-devel] OPAM Dockerfiles set OPAMSWITCH
Anil Madhavapeddy
anil at recoil.org
Tue Feb 23 12:33:44 GMT 2016
On 23 Feb 2016, at 12:28, David Sheets <sheets at alum.mit.edu> wrote:
>
> The Docker containers described by
> https://github.com/ocaml/opam-dockerfiles somehow set the OPAMSWITCH
> environment variable. I haven't been able to find where or why this
> variable has been set and it causes many opam commands to be more
> heavyweight than necessary which makes interactive use annoying. For
> instance, after switching compilers, you must run something like
>
> ```
> eval `opam config env --switch=system`
> ```
>
> if OPAMSWITCH is set. When is OPAMSWITCH necessary? Why? What sets it?
One possibility is that the entrypoint to the container passes the
command through "opam config exec --", which ensures that the local
OPAM context is available when you run the command.
This isn't really designed to support compiler switching, now that
I think about it :-) Perhaps we should rejig the container layout
to have precisely one switch per container? Do you just want to use
the system switch in your usecase?
>
> I'm really enjoying using the opam Docker containers because it means
> that a fresh, minimal, throwaway OPAM install is just a `docker run
> -it --rm -v ~/Code:/Code:rw ocaml/opam:alpine-3.3_ocaml-4.02.3 ash`
> away. Thanks, avsm!
Glad they're coming in handy! I haven't fully documented them and
the layout is fluid until Travis in particular is happy, and I use
them a bit more for interactive use. Feedback is very welcome though;
I aim to document them this week and will update the list on how the
multi-distro Travis support is coming.
Anil
More information about the opam-devel
mailing list