Skip to content

ThisIsntTheWay/headless-anki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Headless Anki

Headless Anki with the AnkiConnect plugin installed.
Useful in automation workflows.

The default user profile is as barebones as it can get.

The following volumes are exposed and can be mounted by the user:

  • /data: Anki data (Profile, decks etc.).
  • /export: Path that can be used for exporting Anki decks, e.g. using the AnkiConnect API.

Usage

To run, execute:

docker run -d -p 8765:8765 -v $(pwd)/export:/export thisisnttheway/headless-anki:latest

To bring your own Anki profile, mount it on /data in the container:

docker run -d -v ~/.local/share/Anki2:/data thisisnttheway/headless-anki:latest

Warning

If you do bring your own profile, make sure that your AnkiConnect configuration doesn't have a listen address of localhost

Tip

Launch the container with the environment var ANKICONNECT_WILDCARD_ORIGIN=1 to set webCorsOriginList in AnkiConnects config to ["*"].
This will modify your existing config if you bring your own profile! Your existing config file will be backed up to config.json_bak_ha first, however.

  • If this ENV var is unset/not equal to 0, this backup will be restored (if existing)

You can also use other QT platform plugins by setting the env var QT_QPA_PLATFORM:

docker run -e QT_QPA_PLATFORM="offscreen" ...

By default, Anki will be launched using QT_QPA_PLATFORM="vnc".
This will enable Anki to be accessed using a VNC viewer which might help with debugging, provided port 5900 is forwarded:

Building

To quickly build the image yourself, issue:

docker build --progress=plain . -t headless-anki:test

Different versions of each component (Anki, QT, AnkiConnect) can be installed.
Supply those versions as build flags:

docker build \
    --build-arg ANKICONNECT_VERSION=24.7.25.0 \
    --build-arg ANKI_VERSION=24.06.3 \
    --build-arg QT_VERSION=6 \
    -t headless-anki:test \
    .

For available versions, refer to:

About

Headless Anki, containerized

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published