Docker usage

I managed to copy into the image of bousi_pack pack source folder using docker ps and docker cp, but when I do pack_install/1 from SWISH prompt I get a permission error after answering the only choice

?- pack_install('file:///home/bousi_pack').
Create directory for packages
   (1) * /root/lib/swipl/pack
   (2)   Cancel

Your choice? 
Warning: 2019-04-24 16:11:51.156 make_directory/1: No permission to create directory `'/root/lib'' (Permission denied)

while using

?- pack_install(bousi_pack, [url('file:///home/bousi_pack'),package_directory('/swish/pack')]). 

it silently fails.

Any hint ?

you could consider these as two problems,

1, should such program read / write such “/root/lib” folder

2, should you have such access within that container

1 Like

Yes, I have 2 problems, but it seems to reduce, this morning i have tried pack_install from github, discovering that shared internet access is not a problem with docker :slight_smile:

docker run -it -p 3050:3050 swipl/swish
% Started server at http://localhost:3050/
?- pack_install(bousi_pack).
% Contacting server at http://www.swi-prolog.org/pack/query ... ok
Install bousi_pack@1.0.0 from GIT at https://github.com/CapelliC/bousi_pack.git Y/n? 

Create directory for packages
   (1) * /root/lib/swipl/pack
   (2)   Cancel

Your choice? 
Warning: 2019-04-25 07:26:54.942 make_directory/1: No permission to create directory `'/root/lib'' (Permission denied)
ERROR: 2019-04-25 07:26:54.943 Cannot find a place to create a package directory.Considered:
ERROR: 2019-04-25 07:26:54.943     /root/lib/swipl/pack
false.

To be true, I would prefer a lot to be able to install SWISH from sources on localhost, just needed docker to get a working configuration, while debugging yarn+webpack instead of bower.

Right now I need something basic - like persist data in the image - it’s done efficiently ? how do I do it ?

SWISH runs as daemon in the container. I typically think it is not a good to modify the content of the docker image. AFAIK, the preferred route for that is to pick the Dockerfile, modify it and create your own image. You can also create a new Docker project that takes swipl/swish as its base image.

If you still want to change the image, run

docker exec -it <image id> bash

that gives you a (root) shell in the container. Start Prolog and install the package. We could create a pack directory as part of the data managed externally by SWISH.

What is the problem getting it running? Note that recent versions switched to yarn from bower. But, you can also simply download the zipped JavaScript dependencies using make bower-zip (should be renamed).

1 Like

Yes, i did, but I’m always running the latest source release, and there were some mismatch. I’ll try better, thanks

Thanks so much, it worked!

carlo@carlo-ubuntu-1604:~$ docker exec -it 717ed136df39 sh
# swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 7.7.18)
...
?- pack_install(bousi_pack).
% Contacting server at http://www.swi-prolog.org/pack/query ... ok
...
Run post installation scripts for pack "bousi_pack" Y/n? 
% mkdir -p ./build
% gcc -c -pthread -fPIC  -I"/usr/lib/swipl/include" -obuild/closure.o extern/closure.c
% gcc -c -pthread -fPIC  -I"/usr/lib/swipl/include" -obuild/blocks.o extern/blocks.c
...
1 Like

Great!

How come your version is so far behind? Maybe you should do a docker pull?