Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #135297
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: GForth in Docker. |
| Date | 2026-08-05 06:35 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2026Aug5.083504@mips.complang.tuwien.ac.at> (permalink) |
| References | <114tl3v$2fsah$1@dont-email.me> <ndf54bF762U1@mid.individual.net> <0b4d65eb-5cb9-4b9d-9a54-df5f0a99b458@gmail.com> |
Nick P <nick.268@gmail.com> writes:
>It came up with the suggestion of opening a terminal in the files
>directory and running the multiline:
>
> sudo docker run -it \
> -v "$PWD":/usr/src/myapp \
> -w /usr/src/myapp \
> forthy42/gforth gforth fac1.fs -e bye
>
>which didn't give me any errors but closed Forth immediately. Losing the
>'-e bye' from the end kept it open, and I was able to use the colon
>definitions in the fac1.fs file at the command line.
Container technologies like Docker try to isolate the stuff inside the
container from the outside, in order to protect the outside from
whatever may go wild inside the container. But these days it is
questionable how well that promise holds up for technologies like
Docker that rely on the OS kernel being secure; VMs make the same
promise, with a higher overhead, and I have read suggestions that
their promise has a better chance of holding up.
You probably do not want this kind of isolation when running Gforth,
but if you use Docker, you get it and have to tell it where to drop
the isolation.
Reading through the man page of docker, the -v option means that your
working directory ($PWD) becomes visible as /usr/src/myapp inside the
container with read and write permissions, and the -w option means
that /usr/src/myapp becomes the working directory inside the
container. So with this command line, you can let gforth access files
in your working directory, but not elsewhere. You may need a changed
-v option or additional -v options if you want to make more
directories visible to Gforth, and adjust -w accordingly.
>So I seem to be able to run an arbitrary file now, but having pre-read
>through "Starting Forth" and "Forth Programmers Handbook" before setting
>out on learning Forth properly, it's clear that may not suffice.
My guess is that these options may be enough for working through these
books.
>So am I correct in thinking it's a Docker issue and I should try to
>understand that?
If you want to do more things with Gforth, like letting Gforth scripts
process files in other directories than your working directory, you
probably should look more closely at the docker options.
Alternatives:
1) Use Ubuntu's gforth package. A disadvantage is that this is gforth
0.7.3, and misses some conveniences of the current development
version.
2) Build Gforth from the tarball; see <https://gforth.org/> for
instructions.
- 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
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
GForth in Docker. Nick P <nick.268@gmail.com> - 2026-08-04 22:21 +0100
Re: GForth in Docker. jkn <jkn+nin@nicorp.co.uk> - 2026-08-04 22:50 +0100
Re: GForth in Docker. Nick P <nick.268@gmail.com> - 2026-08-04 23:20 +0100
Re: GForth in Docker. anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-05 06:35 +0000
Re: GForth in Docker. Kragen Javier Sitaker <kragen@canonical.org> - 2026-09-02 14:26 -0300
Re: GForth in Docker. albert@spenarnc.xs4all.nl - 2026-08-05 10:19 +0200
Re: GForth in Docker. Colin Tree <treecolin@gmail.com> - 2026-08-06 08:47 +1000
Re: GForth in Docker. anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-06 05:08 +0000
Re: GForth in Docker. albert@spenarnc.xs4all.nl - 2026-08-22 16:01 +0200
csiph-web