[Self-interest] Self on Docker

Russell Allen mail at russell-allen.com
Mon May 2 01:17:41 UTC 2022


Hi guys

I'm not a docker expert at all, but I thought it might be interesting to get the SelfVM working on docker, not so much for security but to make it easier to use the VM.
I've put up a script at https://github.com/russellallen/dockerself (https://link.getmailspring.com/link/55C16E53-59CF-4BB0-8663-C48AB637A188@getmailspring.com/0?redirect=https%3A%2F%2Fgithub.com%2Frussellallen%2Fdockerself&recipient=U2VsZi1pbnRlcmVzdEBsaXN0cy5zZWxmbGFuZ3VhZ2Uub3Jn) but its really short so I'll past it below.
Basically the steps are:
1 - install docker
2 - git clone https://github.com/russellallen/dockerself (https://link.getmailspring.com/link/55C16E53-59CF-4BB0-8663-C48AB637A188@getmailspring.com/1?redirect=https%3A%2F%2Fgithub.com%2Frussellallen%2Fdockerself&recipient=U2VsZi1pbnRlcmVzdEBsaXN0cy5zZWxmbGFuZ3VhZ2Uub3Jn)
3 - cd dockerself
4 - ./selfvm -s mysnapshot.self --resetXDisplays
The first time you run this, it will download some docker image layers but these will be cached so it only happens once.

The morphic desktop can be accessed through your webbrowser at http://localhost:10000/index.html?encoding=rgb32&password=111
The flag --resetXDisplays tells the Self world to read the X display from the $DISPLAY environment variable, otherwise it uses whatever it used last time the snapshot was saved.
I've briefly tested on a Mac and Linux (a recent Ubuntu) and it seems to work. I haven't tested on Windows, if anyone wants to try that would be fabulous.
There doesn't seem to be a good way to pass the entire host filesystem to the container, instead I've mounted the home directory at /host inside the container.
Let me know how you go, also if anyone is actually experienced in using docker in anger and has a better way of doing things, please pipe up.
Have fun,
Russell

#!/bin/sh

NAME=$(uuidgen)

docker run -d \
--name $NAME \
-e MODE="tcp" \
-e XPRA_HTML="yes" \
-e DISPLAY=:14 \
-e XPRA_PASSWORD=111 \
-p 10000:10000 \
--rm \
jare/x11-bridge >/dev/null 2>&1

echo
echo 'Welcome to Self on Docker'
echo
echo 'The host system is mounted at /host'
echo
echo 'Open GUI on: http://localhost:10000/index.html?encoding=rgb32&password=111'
echo
echo

# This is annoying but gives xpra time to wake up
sleep 5

docker run \
--net host \
-it \
--rm \
--volume "$HOME:/host/$HOME" \
--workdir "/host/$PWD" \
-h "$HOSTNAME" \
--volumes-from $NAME \
-e DISPLAY=:14 \
russellallen/selfvm:alpha1 $@

docker kill $NAME >/dev/null 2>&1

> g
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.selflanguage.org/pipermail/self-interest/attachments/20220502/4b564b78/attachment.html>


More information about the Self-interest mailing list