Instructions For Docker Compose Using 'ghcr.io'
SamuelBanya opened this issue · 9 comments
EDIT:
- I included some updated config files below, but still am having issues
Hello there,
I have been in the process of trying to deploy a Kiwix instance on a Raspberry Pi 3B+ running Armbian.
That being noted, it was hard to find the fact that there's still a Docker container image for 'Kiwix' itself.
Is there any way that your team update your website to include a 'Containers' section so others can easily find it? I say this because I had to dig on your site to find the post (https://www.kiwix.org/en/our-docker-images-are-on-ghcr-io/), but it really should just have a server section on the Kiwix page itself for people that want to host their own Kiwix instance (https://www.kiwix.org/en/download/) instead of having to make a user look on the 'Releases' section of the GitHub page itself.
That being noted, I tried to use the following two links as references for creating a Docker Compose file to deploy Kiwix but am having issues with it so far:
- https://noted.lol/setup-and-install-kiwix-serve-on-debian-systems/
- https://thehomelab.wiki/books/docker/page/setup-and-install-kiwix-serve-on-debian-systems
On the Pi itself, I basically just created a '/home/pi/kiwix/data' directory that contains the following older Wikipedia .ZIM file rips:
~/kiwix/data$ pwd
/home/pi/kiwix/data
~/kiwix/data$ ls
wikipedia_en_wp1-0.5_2007-03.zim wikipedia_en_wp1-0.7_2009-05.zim wikipedia_en_wp1-0.8_orig_2010-12.zim
This is my Docker compose file so far that I tried within my Portainer instance on the Pi itself:
version: '3'
services:
kiwix-serve:
image: ghcr.io/kiwix/kiwix-serve
volumes:
- /home/pi/kiwix/data:/data
ports:
- '8080:80'
command:
wikipedia_en_wp1-0.5_2007-03.zim
wikipedia_en_wp1-0.7_2009-05.zim
wikipedia_en_wp1-0.8_orig_2010-12.zim
I am unable to see the Kiwix image actually run on a specific port and it is currently in 'Exited' status on Portainer.
These are the logs I'm receiving after attempting to deploy it:
/usr/local/bin/kiwix-serve --port=8080 wikipedia_en_wp1-0.5_2007-03.zim wikipedia_en_wp1-0.7_2009-05.zim wikipedia_en_wp1-0.8_orig_2010-12.zim
Unable to add the ZIM file 'wikipedia_en_wp1-0.5_2007-03.zim' to the internal library.
Here is the content of /data:
/data/wikipedia_en_wp1-0.7_2009-05.zim
/data/wikipedia_en_wp1-0.5_2007-03.zim
/data/wikipedia_en_wp1-0.8_orig_2010-12.zim
Thanks!
Still failing, but related update:
I tried just using one single .ZIM file at a time to see if it was the .ZIM file rips that I got that were part of the issue.
The second .ZIM file (2009 rip) started it for a brief second and a half, and then still exited with roughly the same error as above.
I mention this because I thought maybe it was because I shouldn't add so many .ZIM files in the 'commands' section since they probably need an array or something equivalent for Docker config files.
Is there something wrong with my current Docker compose file syntax above in that case?
Latest Docker Compose file:
version: '3'
services:
kiwix-serve:
image: ghcr.io/kiwix/kiwix-serve
volumes:
- /home/pi/kiwix/data:/data
ports:
- '8080:80'
command:
wikipedia_en_wp1-0.7_2009-05.zim
Latest logs:
/usr/local/bin/kiwix-serve --port=8080 wikipedia_en_wp1-0.7_2009-05.zim
Unable to add the ZIM file 'wikipedia_en_wp1-0.7_2009-05.zim' to the internal library.
Here is the content of /data:
/data/wikipedia_en_wp1-0.7_2009-05.zim
/data/wikipedia_en_wp1-0.5_2007-03.zim
/data/wikipedia_en_wp1-0.8_orig_2010-12.zim
Latest update:
- Just to isolate the .ZIM files I have, I did try to use the latest Arch Linux wiki .ZIM file, and it appears to be running though... the Pi's IP + 8080 isn't working, ex: "blah.blah.blah.blah:8080" doesn't seem to show Kiwix in a browser tab on Firefox.
- This being noted, are old Wikipedia rips not compatible?
- Also, why isn't the IP address + port 8080 good enough to show Kiwix in a browser from the docker container image itself?
Here's the latest Docker compose file I have:
version: '3'
services:
kiwix-serve:
image: ghcr.io/kiwix/kiwix-serve
volumes:
- /home/pi/kiwix/data:/data
ports:
- '8080:80'
command:
archlinux_en_all_maxi_2022-12.zim
Ticket shoukd probably be transfered to kiwix-tools.
@SamuelBanya thanks for your report!
We publish docker images but using them with Docker compose of other tools is outside the scope of our tools obviously.
That said, the issue here is that the kiwix-serve port inside this image is 8080
, not80
so you're binding host's 8080
port to an unused in-container 80
port. That won't work.
I advise you look at the doc.
docker run --rm -p 8080:8080 -v /home/user/data/:/data ghcr.io/kiwix/kiwix-serve wikipedia_fr_climate_change_mini_2023-05.zim
/usr/local/bin/kiwix-serve --port=8080 wikipedia_fr_climate_change_mini_2023-05.zim
The Kiwix server is running and can be accessed in the local network at: http://172.17.0.2:8080
This is on a Pi. Keep in mind that the last log line here is from kiwix-serve which has no idea it's running inside Docker and thus only exposes internal container IP and port.
Last, the message Unable to add the ZIM file 'wikipedia_en_wp1-0.7_2009-05.zim' to the internal library.
is relatively clear: that ZIM could not be added.
Please try your setup with a recent ZIM file and once everything's working as expected, then try with one of your ZIM to confirm it's the issue.
Should there be an issue with a specific ZIM, please open a separate ticket.
Hello @rgaudin
Okay thanks, that helped. Can your team please also put a link on the main Kiwix page to a 'Containers' section though?
That would help a ton. That and include the 'tools' repo like you showed above as that was a bit buried, and would be great for people into self hosting stuff like myself.
This is what worked for me after removing the old Wikipedia .ZIM rips which now successfully shows up on the Pi's IP + 8080:
version: '3.3'
services:
kiwix-serve:
image: ghcr.io/kiwix/kiwix-serve:latest
volumes:
- /home/pi/kiwix/data:/data
ports:
- '8080:8080'
command:
- '*.zim'
One other question for your team though:
How would I get an older Wikipedia rip based .ZIM file to be actually read?
Should I use an older version of 'kiwix'?
Just curious for my own benefit?
@Popolechien, I agree the website ought to include the containers instructions.
@SamuelBanya I think so but I don't know the versions/times of those changes. You should open a ticket on libkiwix with the details of your ZIMs and someone (@kelson42 I guess) will be able to respond
@rgaudin Added links to https://www.kiwix.org/en/downloads/kiwix-serve/ Will this do?
Yes I think that's fine