A SWISH (SWI-Prolog for SHaring) docker
Building the image
The image is built by running
Running the image
The image may be used in many configurations, both controlled by docker
options and options to the entry point. As basic operation typically
already requires publishing ports and setting up a volume for the data,
we added a bash script
swish.sh that automates the common scenarios by
docker run options from defaults and provided options. When
-n, as in
./swish.sh -n option ..., it merery prints the
docker command it will execute. The following options are processed:
-p N:3050. Default is 3050.
Mount the given directory as data. Default is the working
--volumes-from rserveto connect to an R docker
Just print the docker command that will be executed.
Pass on (interactive)
All remaining options are passed to the entry point of the image.
The docker image maintains its data (user programs and configuration) on
/data. This may be mapped to a host directory using the
-v options (see also the
--data=dir option of
Within the data directory, SWISH manages the following items:
config-enabled is a directory where the configuration is stored.
If it doesn't exist it is created and filled with a default
configuration that depends on the provided options. The directory
and its files have the same owner and group as the root of the managed
data is the directory where all dynamic user data is maintained.
If the directory exists, the SWISH server is started with the user and
group of the directory. If it doesn't exist the directory is created
as owned by
daemon.daemonand the server is started with these
https If the
--httpsoption is passed, it creates or reuses
this directory and the files
created certificate is self-signed.
passwd If authenticated mode is enabled, this file maintains
the users and password hashes.
The container creates a server at port
3050. By default this is an
HTTP server. If
run <docker options> swish --https is used, an HTTPS
server is started.
The entry point
The entry point of the containser is
/entry.sh, a shell script that
initialises the data volume if needed and starts the server. It accepts
the following options:
Instead of starting the server, start a bash shell. Terminate after
Use N HTTP worker threads. Default is 16.
Emit short help.
The SWISH configuration is controlled by files in the
directory. Several commands may be used to control the configuration.
These are executed as below:
docker run -it swish option ...
The options provided are:
List installed and available configuration items. If an item is
installed, indicate whether it is modified.
Change the configured authentication scheme. This is one of
Run in fully authenticated mode, forcing the user to login
and allowing to execute arbitrary commands. When executed for
the first time, docker must be run interactively (
to create the first user. Additional users are created using
docker run -it swish --add-user.
Use social login. By default enables optional http login,
login using google and stackoverflow. Both need to be further
configured by editing
anon(or annoymous) <br>
This is the initial default, providing fully anonymous login,
executing only sandboxed Prolog queries.
--add-config file ...<br>
Add one or more configuration files by copying them from the
available configuration directory.
Add a new user to the HTTP authentication. Prompts for user name,
email, group (unused, use
users) and password.
Create an HTTPS server. This uses the certificate from the
httpsdirectory (see above). If no certificate exists, a
self-signed certificate is created. The details may be refined