使用docker部署anki(没成功,还是用ankiweb吧)

部署

保证docker环境,运行下列代码:

export DOCKER_USER=root export ANKI_SYNC_DATA_DIR=/etc/anki-sync-server export HOST_PORT=27701

mkdir -p “$ANKI_SYNC_DATA_DIR” chown “$DOCKER_USER” “$ANKI_SYNC_DATA_DIR” chmod 700 “$ANKI_SYNC_DATA_DIR”

docker run -itd
–mount type=bind,source=“$ANKI_SYNC_DATA_DIR”,target=/app/data
-p “$HOST_PORT”:27701
–name anki-container
–restart always
kuklinistvan/anki-sync-server:latest

删除重装可能会报错driver failed programming external connectivity on endpoint,restart一下docker就好了

systemctl restart docker

占用27701端口

添加用户

执行以下代码,进入容器

docker exec -it anki-container /bin/sh

参考以下设置

adduser <username> - add a new user
deluser <username> - delete a user
lsuser             - list users
passwd <username>  - change password of a user

或查看帮助

./ankisyncctl.py --help