Did anybody look into running Coq in Docker but using IDEs with it? I could put docker run ... -v <map local folder> -- coq
in a wrapper, but I wanted to ask before reinventing the wheel
as a bonus, it seems one can connect to a remote Docker daemon and run Coq on a more powerful computer
(TODO: read https://nickjanetakis.com/blog/docker-tip-73-connecting-to-a-remote-docker-daemon)
Paolo, please post your findings somewhere if you find a solution. I'm also interested in this setup (more from the prospect of managing student setups than my own, probably).
for what is worth, we are running Why3's graphical interface from inside a Docker, so I presume the exact same setup would work for Coq (note that the IDE is shipped as part of the Docker image; we are not trying to make an external editor interact with binaries inside an image, so I do not know if that is what Paolo intended): https://why3.gitlabpages.inria.fr/why3/install.html#installation-via-docker
It's not docker, but a similar container based package. It's still in beta phase (not listed in the search engine). Feedback is welcome especially for students. It's based on the Coq platform, so it contains all that is in there (if you want to add something, ask there): https://snapcraft.io/coq-prover
It comes with CoqIDE and modulo https://github.com/coq-community/vscoq/pull/194 (or a manual config) works with vscode as well
(CoqIDE runs from the container, vscode is not bundled, but can be found in the same store)
"Coq Interactive Prover" sounds awkward
I can change the title, but the store admins suggested to make it clear what it is. What do you find weird? Would "Coq - Interactive Prover" work better?
the only ones that make sense to me are "Coq Interactive Theorem Prover" and "Coq Proof Assistant"
OK, thanks for the suggestion
updated
@Enrico Tassi almost all the licenses for the platform are nicely SPDX, but IMO the license for Coq should be fully SPDX as well: LGPL-2.1-only
(right now it's LGPL-2.1
on the snapcraft page)
I also think you should add the Development
category in addition to Science and Education (e.g., CoqIDE is essentially a tool like VsCode, which uses Development category, https://snapcraft.io/code)
Unfortunately I can only have 2 categories, maybe education is a bit of a stretch... but development is as well a bit of a stretch imo
For the license, I did select 2.1-only from a list of SPDX, and it is printed like that. In the package description I take the ones from OPAM. I also tried to write a custom SPDX expression, but I get a parse error at -only
why is Development a stretch? I disagree, given all the verified software projects using Coq.
given only two categories, I would go with Science and Development
OK, done
For the license, I really don't know how to improve
I guess it's fine. We can only blame the FSF for the annoying or later stuff
Screenshot-from-2021-01-14-19-13-22.png
I think it is a rendering issue/choice
sigh, probably some frontend processing they do then.
https://snapcraft.io/search?q=coq and https://snapcraft.io/search?q=coq-prover find nothing? Just because it's beta?
@Enrico Tassi where's the source of the snap package?
I can't find a link from https://snapcraft.io/coq-prover...
in any case, my use case seems closer to Why3, plus it might include some internal software: my company has an opam repository, Coq binary, coqdep patch, and our choice of Coq plugins.
OTOH, part of the motivation was harder-to-install dependencies like coinor-csdp (psatz's backend), and for that I opened a thread.
okay, found the answer: browsing the sources is not supported, I have to download the snap (https://merlijn.sebrechts.be/blog/2020-08-17-verify-snap/). I'll infer snap might not be what I specifically need. Still cool.
The sources are here
https://github.com/coq/platform/tree/v8.13/linux
It is not listed cause I didn't make the snap fully public yet
Adding software is trivial, you can edit https://github.com/coq/platform/blob/v8.13/coq_platform_packages.sh for opam stuff, or edit the snapcraft file for Debian stuff
Btw, being able to customize the platform is an objective of the platform scripts (eg for teachers) so feel free to ask around if doc or features are missing
Initial analysis suggests supporting Emacs might be easy — cmdline coqtop works out of the box with
docker run --rm -i some_coq_image coqtop
but I'm only assuming that's all that Emacs needs.
That works even under rlwarap:
rlwrap docker run --rm -i some_coq_image coqtop
notably, that doesn't work well with the common run -it
, because the latter allocates a pseudo-tty (like e.g. ssh would), which is not what rlwrap (or most clients) expect.
or rather, supporting vscoq & c. _outside_ might be harder — vscoq listens on some localhost ports and expects coqidetop to connect to them. But vscoq actually listens on _localhost_, preventing access from other machines (which, likely, is for the better) or even containers (except maybe on Linux with https://stackoverflow.com/a/57422557/53974).
I'll look into Why3's approach next (_at some point_), but I'd expect some trouble running VsCode in a container (at least, it using the wrong keybindings for a Mac)
@Anton Trunov do you have students use Emacs, coqide, or vscoq?
It's vscoq mostly and a bit of coqide
Paolo Giarrusso said:
except maybe on Linux.
Yes, if you choose --network host
, then the container uses the same network stack, so connections to localhost
work fine.
More portable idea (for non-Linux): have the wrapper parse the relevant options to find the chosen ports, and interpose an ssh
tunnel between the two machines. (or apparently socat if you don't need the security, e.g. when using Docker https://unix.stackexchange.com/a/187038/28519)
@Aleksey Arens here’s a fun candidate for “running Coq inside a VM-y thing”
(hm, I should find the time to do it)
Paolo Giarrusso said:
Aleksey Arens here’s a fun candidate for “running Coq inside a VM-y thing”
I wonder if Coq could run inside a mirageOS instance? I doubt it should, since it's not SMP AFAIK.
Paolo Giarrusso said:
Did anybody look into running Coq in Docker but using IDEs with it? I could put
docker run ... -v <map local folder> -- coq
in a wrapper, but I wanted to ask before reinventing the wheel
I presume, a text-based connection is all that is needed. In that case, emacs's proof-general would be more than adequate. I also don't see any great difficulties with adjusting any existing IDEs to work over a network connection; worst case scenario would involve interacting with socat, possibly through a wrapper binary.
I've run Coq in VMs before and connected to it using a local Emacs + TRAMP; not sure how well that would work with Docker
If Emacs is good enough for you (it’s not for me), wrapping coq with the right “docker run” incantation should just work. That’s a common Docker use-case.
(And I did some experiments above).
Something I recently tried with Why3 is to run it using Broadway. And surprisingly enough, it works out of the box. (Despite all its flaws, GTK never ceases to amaze.) You just need to set the environment variable GDK_BACKEND=broadway
before running coqide
and to export port 8080 of your Docker container, and that is it. (Possibly, you might have to first execute broadwayd &
in your Docker container. I have never quite understood when explicitly running the multiplexer is needed.)
And I missed the most important part: You have to point your web browser to localhost:8080
, since the whole point of changing the backend is to use your browser as the graphical interface of coqide
.
Oooooh https://developer.gnome.org/gtk3/stable/gtk-broadway.html (for all the others who'll be googling)
gares@ollypat:~/MATHCOMP/hierarchy-builder$ broadwayd :5
Listening on /run/user/1000/broadway6.socket
^Z
[1]+ Stopped broadwayd :5
gares@ollypat:~/MATHCOMP/hierarchy-builder$ bg
[1]+ broadwayd :5 &
gares@ollypat:~/MATHCOMP/hierarchy-builder$ GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 coqide
Unable to init server: Could not connect: Connection refused
Fatal error: exception Gtk.Error("GtkMain.init: initialization failed\nml_gtk_init: initialization failed")
Generic troubleshooting Qs: Do all GTK versions support Broadway? My link is for gtk3, and I'd bet there's a compile-time flag? You'd hope if you have the daemon it was enabled.
ii libgtk-3-0:amd64 3.24.20-0ubuntu1 amd64 GTK graphical user interface library
it's related to lablgtk
if I run a native gtk app, then it works
I've 3.1.1, maybe @Guillaume Melquiond used an older version and this is a regression
ah ah, no, my bad
it works
I was runing coqide from the snap package, which is "app armored" (I think I did not give it the network capability)
Yes, broadwayd
needs to run inside the container. And then you just export the port it opens.
Never got around to this but VsCode's previewing a general solution:
https://code.visualstudio.com/docs/remote/containers#_quick-start-open-an-existing-folder-in-a-container
Last updated: Oct 05 2023 at 02:01 UTC