Skip to content

Latest commit

 

History

History
81 lines (58 loc) · 2.85 KB

README.md

File metadata and controls

81 lines (58 loc) · 2.85 KB

Anki Sync Server Docker Container

This docker container simply wraps the official minimal sync server based on Python. More information can be found in the official documentation.

Configuration

The docker container uses the same environmental variable as described in the official documentation. For more information, please consult it directly. The following environmental variables are bound to the container's setup and therefore, should not be changed:

  • SYNC_BASE
  • SYNC_HOST
  • SYNC_PORT

At least the following environmental variables has to be set outside of the container:

  • SYNC_USER1: The username and password for the first user in the format user:password.

In case of using PASSWORDS_HASHED=1 and hashing password with pbkdf2, please take care to correctly escape any dollar signs ($) before using them in the terminal or an .env file.

Running the Docker Container

To start the Anki sync server in a Docker container:

docker run \
  -d \
  --name anki-syncserver \
  --user anki:docker \
  -p 8080:8080 \
  -v ./data:/data \
  -e SYNC_USER1=user:password \
  ghcr.io/lorenzschmid/anki-syncserver
  • -d: Runs the container in detached mode.
  • --name: Assigns a name to the container (anki-syncserver).
  • --user: Assigns the user and group under which the container should run (rootless).
  • -p 8080:8080: Maps port 8080 on the host to port 8080 in the container.
  • -v ./data:/data: Mounts the host directory ./data to the container’s /data directory for data persistence.
  • -e SYNC_USER1=user:password: Sets the SYNC_USER1 environment variable to configure the sync server’s username and password.

or via docker compose:

version: '3.8'

services:
  anki-syncserver:
    image: ghcr.io/lorenzschmid/anki-syncserver
    container_name: anki-syncserver
    user: "anki:docker"  # Replace with your desired user_id:group_id
    environment:
      SYNC_USER1: "user:password"  # Replace with your desired username:password
    ports:
      - "8080:8080"
    volumes:
      - "./data:/data"
    restart: unless-stopped

Updating the Docker Container

Upon each restart, the docker container verifies that it runs with the most recent version of the official sync server and updates automatically if a new version is available. The docker image itself likely does not need an update.

Building the Docker Image Locally

  1. Clone this Repository:

    git clone https://github.com/lorenzschmid/anki-syncserver.git
    cd anki-syncserver
  2. Build the Docker Image: Run the following command in the directory containing your Dockerfile:

    docker build -t anki-syncserver .

    This command builds the Docker image and tags it as anki-syncserver.