Starting Prolog http server trough docker

I’m using: SWI-Prolog version 64 bits, version 8.1.16-22

I want to deploy my Prolog http server as a docker container. I have created a script, which loads all dependencies and predicates and starts prolog http server. When I do it locally it works fine. When I am trying to do it trough docker, it starts and it loads everything successfully, but when it runs trough all the lines it just exits with code(0), I was wondering is there a proper way to start a prolog script from terminal? So it would not exit when it runs trough code?

:- set_setting(http:cors, [*]).
server(Port) :-
	atom_concat(Base, '/cert/server.pem', Server),
	atom_concat(Base, '/cert/private_key.pem', PrivateKey),
                        [ port(Port),
                      ssl([ certificate_file(Server),
CMD [ "/root/bin/swipl", "" ]

Added infinite loop with sleep, that solved the issue for now.

Later will look into how this script can be run as a daemon.

That is a solution. I typically use thread_get_message/1 to block. That also allows you to send something to this queue and make the main thread do something (or stop).

1 Like

I found

ENTRYPOINT [“swipl”]
CMD ["/app/", “–user=daemon”, “–fork=false”, “–port=8888”]

Please check

1 Like