[[https://i.imgur.com/WmsnCUo.jpg][HD Windows image]]
** Major benefits
- Automatically get Spacemacs layers dependency installed with [[./deps-install/README.org][installer scripts]]
- Reap the benefit of Emacs and other GNU/Linux tools on Windows/MacOS machines
- Use [[https://hub.docker.com/][docker hub]] to auto-build your environment and store full backups for free
- Build once and work with the same development environment everywhere
- Run untrusted/risky code in the tunable sandbox with CPU/network/disk quotas
- Try new tools, experiment and roll back changes when something goes wrong
- Share your setup with others or extend someone else's development environment
- Run multiple Emacs instances on the same machine isolated
- An easy way to swap Emacs version (=emacs25==emacs-snapshot=) for debugging
- [[https://docs.docker.com/engine/reference/commandline/pause][pause]] container to free resources temporarily
- [[https://github.com/docker/docker/blob/1.13.x/experimental/checkpoint-restore.md][Checkpoint & Restore]] - maybe the fastest way to start a "heavy" environment
- Friendly for networks with low upload speed/quotas.
* How to setup
The idea is to build your own image [[https://docs.docker.com/engine/reference/builder/#from][FROM]] the one of the provided base images
([[file:../../../Dockerfile.emacs25][spacemacs/emacs25]] and [[file:../../../Dockerfile.snapshot][spacemacs/emacs-snapshot]]). Get [[https://docs.docker.com/engine/installation][docker]] for the OS of
the machine that will run development environment and then use
[[https://github.com/JAremko/spacemacs-docker-seed][spacemacs-docker-seed]] as an example to create [[https://docs.docker.com/docker-hub/builds/][automated builds on Docker Hub]] or
[[https://docs.docker.com/engine/reference/commandline/build/][build it locally]].
* How to use
With one of the methods below replace =spacemacs/emacs25= with your images.
NOTE: The guide assumes that you want to run Docker and connect to it from
the same machine.
** MacOS
Get [[https://www.xquartz.org][XQuartz]] and =open -a XQuartz= In the XQuartz preferences go to the "Security"
tab and make sure you’ve got "Allow connections from network clients" ticked
Get [[https://www.cygwin.com][Cygwin]] with =xinit=, =xorg-server= and optionaly [[https://github.com/rprichard/winpty][winpty]](to run Emacs container with =-t=)
- Read/write rss/email with Emacs in web-browser (O_O) [[https://imgur.com/wDLDMZN][demo]]
*** Cons
- Lag spikes with some OSes
*** Instruction
It's a good idea to read [[https://github.com/JAremko/docker-x11-bridge][docker-x11-bridge]] and [[https://www.xpra.org/trac/][Xpra]] documentations, but
here is a short instruction:
**** With Xpra desktop client
Get [[https://xpra.org/][Xpra]] client for your OS. then
#+BEGIN_SRC sh
docker run -ti --rm --name x11-bridge \
-e MODE="ssh" \
--net=host \
-v ~/.ssh/pub_rsa:/etc/pub-keys/me.pub \
-e DISPLAY=:14 \
jare/x11-bridge
docker run -ti --rm --name spacemacs \
--volumes-from x11-bridge \
-e DISPLAY=:14 \
-e TZ=<your_time_zone> \
spacemacs/emacs25
#+END_SRC
Now you can connect to it with Xpra desktop client
#+BEGIN_SRC sh
<XPRA EXECUTABLE> attach --encoding=rgb \
--ssh="ssh -o StrictHostKeyChecking=no -p 22" \
ssh:xpra@localhost:14
#+END_SRC
**** Via web-browser
#+BEGIN_SRC sh
docker run -ti --rm --name x11-bridge \
-e MODE="html" \
--net=host \
-e XPRA_PASSWORD=<PASSWORD> \
-e DISPLAY=:14 \
jare/x11-bridge
docker run -ti --rm --name spacemacs \
--volumes-from x11-bridge \
-e TZ=<your_time_zone> \
-e DISPLAY=:14 \
spacemacs/emacs25
#+END_SRC
Now visit http://localhost:10000/index.html?encoding=png&password=<PASSWORD>