Use SWI-Prolog DockerHub image

Note: Do not reply to this topic, questions, concerns, comments, etc. are to be handled in
Wiki Discussion: Use SWI-Prolog DockerHub image

This does not explain how to install Docker as that is operating system dependent and well documented in the link.
This just demonstrates using the SWI-Prolog DockerHub image.

Note: The version of SWI-Prolog installed as a Docker image will typically be a few releases behind the current development version, e.g. current version: 8.3.1, version in Docker image: 8.2.0. Unless you need a recent patch this should suffice.

Jan W. is doing some work with the Docker releases so this may change again.
There are now some Docker Image tags,

  1. latest - for latest development version.
  2. stable - for latest stable version.
  3. release number - for a specific version.

Also check the dockerfile so that you know what is in the container. There may be an addition/removal or something like a library or something you expect but is not added with the image. Remember you can always build another Dockerfile for yourself with the changes.
Also since you can get root access into a container, you could add what you need, but then you would not be using Docker as intended.

  1. docker pull swipl
  2. docker run -it swipl
Details

These example steps were done using Windows 10 command prompt.

C:\Users\Eric>docker pull swipl
Using default tag: latest
latest: Pulling from library/swipl
babf97a3f00a: Pull complete
2f2a798fd949: Pull complete
93306910516f: Pull complete
Digest: sha256:79302422d49e29dd47326059e578c72cc974d7fbb51bf132ff0b9f5129b9f603
Status: Downloaded newer image for swipl:latest
docker.io/library/swipl:latest

C:\Users\Eric>docker run -it swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.2.0)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- pwd.
% //
true.

?-

It really is that simple.


Notes:

The path shown with pwd/0 is the root of the files system in the Docker container. This is because SWI-Prolog is running in a Docker container which is a self contained system with its own file system. So if you destroy the Docker container, any files created will be destroyed. If you need to save your work to your local file system, Use volumes


If you need to start up the container with OS access, e.g. bash

docker run -it swipl bash

Details
C:\Users\Eric>docker run -it swipl bash

root@75b5d9362fea:/# uname -r
4.19.128-microsoft-standard

root@75b5d9362fea:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

From bash you can still start up SWI-Prolog

root@75b5d9362fea:/# swipl

Details
root@75b5d9362fea:/# swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.2.0)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?-

References:

Docker Containers are not VMs
SWI-Prolog Docker images
GitHub SWI-Prolog/docker-swipl
DockerHub swipl
What Is a Dockerfile?
Best practices for writing Dockerfiles