Add ARM-based variant Docker Image
nathmo opened this issue · 16 comments
- AnkiDesktop version number:2.1.35
- AnkiDroid version number: Not used
Summary
I tried to install this docker image on ubuntu server for ARM 64 bit and it failed miserably with
"anki-sync-server_1 | standard_init_linux.go:211: exec user process caused "exec format error""
I didn't realised the image was not compatible with ARM (im a noob to docker too)
Reproduction (what did you do - the more details you give, the better):
create docker-compose.yml as explained
ran docker-compose up
What was expected to happen:
the docker work normally.
What happened instead (the more details you give, the better):
What would be nice
a procedure to install it on ARM architecture. raspberry are inexpensive for student like me and quite handy
I would be glad to help altough i have very limited knowledge of docker
Hello,
I think it is the same as kuklinistvan#11. Can you rebuild the image on your platform and try it again?
Sorry I missed this one :"kuklinistvan/docker-anki-sync-server#11"
I will try but i have no experience on how to make a docker image.
I believe i should install this manually ? https://github.com/ankicommunity/anki-sync-server
but if you could give me a track on how to do so i would be really thankful
From kuklinistvan/docker-anki-sync-server#11 :)
Please enter the Docker directory and execute build.sh.
All you have to do is to clone this repository to your Pi and execute build.sh
;)
After that, try to start the container again by executing the same command, but this time reference the image with anki-sync-server:tsudoko-ankisyncd-2.1.0-plus-2bfccf7f (as present in build.sh).
okay i ran the build.sh im just confused so to recap :
git clone https://github.com/ankicommunity/docker-anki-sync-server
cd docker-anki-sync-server/Docker
./build.sh
I believe i've made a docker image (seems that a docker image is like a class )
i want to start a container (a container seems to be is like an object instance of it's class)
I used to do it with docker-compose up and the docker-compose.yml. and im not very comfortable with docker itself
I ran "docker run --publish=27701:27701 --restart=always --name=anki-container --mount=type=bind,source=/mnt/anki/data,target=/app/data anki-sync-server:tsudoko-ankisyncd-2.1.0-plus-2bfccf7f"
EDIT 1 : Dont forget the "--publish=27701:27701" otherwise the anki server wont be accessible to others
EDIT 2 : Dont forget the "--restart=always" otherwirse the server dont restart with the OS
EDIT 3 : --mount=type=bind,source=/mnt/anki/data,target=/app/data mount the file inside docker to a phisical location on disc such that you dont lose all data at every restart of the container
i got this in the terminal
Creating new configuration file: ankisyncd.conf. Creating new authentication database: auth.db. Creating collections directory: collections. Updating database schema Successfully updated table 'auth' No session DB found at the configured 'session_db_path' path. Starting tsudoko's anki-sync-server [2020-10-06 10:43:50,853]:INFO:ankisyncd:ankisyncd [unknown version] (https://github.com/tsudoko/anki-sync-ser ver) [2020-10-06 10:43:51,110]:INFO:ankisyncd:Loaded config from /app/anki-sync-server/ankisyncd.conf [2020-10-06 10:43:51,113]:INFO:ankisyncd.users:Found auth_db_path in config, using SqliteUserManager for auth [2020-10-06 10:43:51,119]:INFO:ankisyncd.sessions:Found session_db_path in config, using SqliteSessionManager for auth [2020-10-06 10:43:51,126]:INFO:ankisyncd:Serving HTTP on 0.0.0.0 port 27701... [2020-10-06 10:43:51,613]:INFO:ankisyncd.http:127.0.0.1 "GET / HTTP/1.1" 200 16
I believe it worked and it's running
I ran docker ps
looked the docker id and then ran docker exec -it dde248e9bc6e /bin/sh
dde248e9bc6e being the docker id.
next i ran ./ankisyncctl.py adduser nathmo
so i created an user
How do i commit the raspberry img that i build so that other people dont have to redo it ?
Hello again,
and im not very comfortable with docker itself
I would like to do my best to make your experience as painless as possible. Unfortunately, though, I do not have the time to provide you absolute-beginner Docker support, mostly because you can find the accurate answers in a couple seconds on Google - or you can wait for me a day or two to direct you to the search result.
a docker image is like a class ?
i want to start a container
a container is like an object ?
If you are not familiar with the Docker terminology (such as what is a container or image exactly), you may look up the Docker Glossary here. To answer more directly, a container is an instance of an image, that is, from this point of view, your analogy could be appropriate.
How do i commit the raspberry img that i build so that other people dont have to redo it ?
The answer for your question is probably docker commit - glancing at the reference, it allows you to create an image from an existing container.
You are welcome if you create and publish an image for the Raspberry Pi, the reason I do not have one is that I do not own such a board and cannot regularly check if the image works on it. If you would like to create and maintain a new (ARM port of the) image, we're happy to have you on board at Anki Community - you may contact us more directly at Gitter and discuss this with us. At the very least I can make a reference to your image in the README of this repository.
I honestly did not want to be rude, I just really think that this kind of support on the very-very basics of Docker is out of the project scope. I'm wishing you good luck! ;)
thanks a lot. i figured out many things in the span of 24 hours. For beginners like me it's nice to have a few keyword to google, an entry point more than full nooby guide that aldready exist somewhere else. (Thanks a lot for the glossary)
I will investigate the docker commit thing.
If i may offer my help to update the documentation in a more beginner friendly way i would be glad too.
I'm happy to accept pull requests, if you wish to help ;)
Hey, so I was able to successfully build the Docker image on ARM by changing FROM library/python:3.7.0-alpine3.8
to FROM arm64v8/python:3.7.0-alpine3.8
in the Dockerfile. Haven't tested it extensively, but things look decent from the logs and it's able to respond behind nginx.
Not sure how much help this is to anyone, but thought I would leave a note.
I have no issue while building and running a self compiled docker image on armv7l (raspberry pi) with the original docker file.
I have no issue while building and running a self compiled docker image on armv7l (raspberry pi) with the original docker file.
Oh weird, you're right. I guess it pulls the native image by default. Disregard then.
I think it is worth having a multi-arch image as part of this repo. I have setup a multi-arch image at samtan/anki-sync-server:latest
which should work with amd64 and arm64. I have also setup Github Actions for this here: https://github.com/samyak-jain/anki-sync-server. Would be happy to help upstream this if the maintainers are ok with that.
@samyak-jain That would be great! A PR would be very welcome :)
I have setup a multi-arch image at
samtan/anki-sync-server:latest
which should work with amd64 and arm64. I have also setup Github Actions for this here: https://github.com/samyak-jain/anki-sync-server.
Using the image on my 64 bit Ubuntu Server Raspberrypi 4 it seems to be having an issue with syncing the actual cards. It is syncing media but tells me "There was an issue with AnkiWeb, please try again in a few minutes" and the cards don't actually sync. Could the Anki Desktop version be the issue?
Hello,
I think it is the same as kuklinistvan#11. Can you rebuild the image on your platform and try it again?
This would help if there was a way to build it on other platforms. Originally I was just going to use the Dockerfile to use docker buildx to target ARM64, but that doesn't work either.
This has been an absolute shtshow of trying to compile/use the dockerfile. The dockerfile when used gives an error about
"Could not find a version that satisfies the requirement anki==2.1.40" and it seems like it has not been updated in a while.
Whereas Makefile doesn't work at all becasue it's not for ARM64...
=> ERROR [builder 4/4] RUN sh ./bin/download-release.sh && pip3 install --upgrade pip && pip3 install --user -r . 83.2s
------
> [builder 4/4] RUN sh ./bin/download-release.sh && pip3 install --upgrade pip && pip3 install --user -r ./release/requirements.txt:
#0 2.571 Cloning into 'anki-sync-server'...
#0 57.95 Requirement already satisfied: pip in /usr/local/lib/python3.9/site-packages (22.0.4)
#0 61.99 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#0 78.36 Ignoring orjson: markers 'platform_machine == "x86_64" and python_version >= "3.8"' don't match your environment
#0 80.53 ERROR: Could not find a version that satisfies the requirement anki==2.1.40 (from versions: 2.1.24+359b9f5c, 2.1.25, 2.1.26, 2.1.28, 2.1.29, 2.1.30, 2.1.31, 2.1.32, 2.1.33, 2.1.34, 2.1.35)
#0 80.54 ERROR: No matching distribution found for anki==2.1.40
------
error: failed to solve: executor failed running [/bin/sh -c sh ./bin/download-release.sh && pip3 install --upgrade pip && pip3 install --user -r ./release/requirements.txt]: exit code: 1
I have never had so much frustrating trying to install a docker container as this one.
Hi @AIndoria,
I'm sorry you're having trouble getting this to work and I understand that can be quite frustrating. I'm happy to help you though it.
I only ask we be a bit more productive with our messages. Certain language in your message can come across as aggressive to those who are contributing their free time to assist with this project.
Have you tried the images provided by @samyak-jain : https://github.com/samyak-jain/anki-sync-server
@Flaykz-png Can you share which desktop version you are using? And which version of anki-sync-server you are using?