ant…@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>In particular, gforth-1.0.0 for AMD64 and ARM64 already exists on
>Docker, and you can run it with
>
>docker run -it --rm forthy42/gforth gforth
>
>(or use gforth-fast or gforth-itc instead of the last "gforth").
>
>However, currently there is only the tag "latest" for gforth images on
>hub.docker.com, so when Bernd Paysan (forthy42) puts the next snapshot
>on hub.docker.com, you will get an upgrade to that. I hope he will
>add a tag for 1.0 or 1.0.1, and then the command above should look
>like
>
>docker run -it --rm forthy42/gforth:1.0 gforth
Bernd Paysan has now built docker images with tags 1.0.0 and 1.0.1, so
you can start, e.g., gforth-fast 1.0.1 with
docker run -it --rm forthy42/gforth:1.0.1 gforth-fast
One other aspect of Docker is: by default it does not allow the gforth
engine running in the container to access files outside the container.
I played around a little with the options --volume (-v), --mount, and
--user (-u), but could not get the gforth in the container to write
outside the container.
But at least I managed to get it to read files that everyone is
allowed to read:
docker run -v /nfs/nfstmp:/nfs/nfstmp -it --rm forthy42/gforth:1.0.1 \
gforth-fast /nfs/nfstmp/anton/gforth-amd64/onebench.fs
I happen to have a file at /nfs/nfstmp/anton/gforth-amd64/onebench.fs,
so the -v option mounted /nfs/nfstmp outside the container at
/nfs/nfstmp inside the container, and then gforth-fast could access
it. The following also works:
docker run -v /nfs/nfstmp:/mymount -it --rm forthy42/gforth:1.0.1 \
gforth-fast /mymount/anton/gforth-amd64/onebench.fs
and makes it clearer which directory is which: /nfs/nfstmp is the
directory outside the container, /mymount is the mount point inside
the container, and the gforth-fast inside the container them accesses
the file through that mount point.
The Gforth shorthands for your home directory (~) and the home
directories of other users (~<user>), or the working directory (~+) do
not work as intended when using gforth running in docker. Any shell
expansions that happen before docker passes the string to Gforth
inside the container are unaffected by this, though.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2026 CFP: http://www.euroforth.org/ef26/cfp.html