QNAP 上配置 docker-icloudpd

最近在 QNAP 上重配 docker-icloudpd,卡了半天。

容器能启动,配置也挂进去了,但一跑初始化就报错:

1
docker exec -it icloudpd_user1 sync-icloud.sh --Initialise

常见的是这两个:

1
2
su: unknown user user
ERROR Keyring file does not exist. Please try again

QNAP 上这个坑基本都在权限。Container Station 用 “应用程序” 拉起来以后,容器里的用户、组、挂载目录所有权,经常对不上。

结论

如果你是用 QNAP Container Station 的 “应用程序” 创建的,直接把它当成一份 compose 维护就行。

关键就一件事:usergroupuser_idgroup_id,以及 /config/iCloud 的权限,要前后一致。

这个问题在这里也有人提过:

https://github.com/boredazfcuk/docker-icloudpd/issues/886

先把权限修好

我这里用的是:

1
2
3
4
- user=user
- user_id=1026
- group=users
- group_id=100

那初始化前先执行一遍:

1
2
3
4
5
6
7
8
9
docker exec -it icloudpd_user1 sh -lc "
addgroup -g 100 users 2>/dev/null || true
adduser -D -H -u 1026 -G users user 2>/dev/null || true
mkdir -p /config/python_keyring
chown -R 1026:100 /config /iCloud /config/python_keyring 2>/dev/null || true
chmod -R u+rwX,g+rwX /config /iCloud /config/python_keyring 2>/dev/null || true
id user
ls -ld /config /iCloud /config/python_keyring
"

看一下输出,确认 /config/iCloud 的所有权是 1026:100,再跑初始化:

1
docker exec -it icloudpd_user1 sync-icloud.sh --Initialise

compose 示例

下面这份可以直接改。记得把 apple_id 和宿主机目录换成你自己的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
networks:
icloudpd:
name: icloudpd
driver: bridge
ipam:
driver: default
driver_opts:
com.docker.network.bridge.name: icloudpd

volumes:
icloudpd_user1_config:
name: icloudpd_user1_config

services:
icloudpd_user1:
hostname: icloudpd_user1
networks:
icloudpd:
aliases:
- icloudpd_user1
environment:
- TZ=Asia/Shanghai
- apple_id=你的AppleID
- icloud_china=true
- auth_china=true
- user=user
- user_id=1026
- group=users
- group_id=100
image: boredazfcuk/icloudpd
healthcheck:
test: /usr/local/bin/healthcheck.sh
start_period: 30s
restart: always
volumes:
- icloudpd_user1_config:/config
- /share/你的路径/icloud/:/iCloud

我现在就是按这个思路配:把它当 compose,用同一套 UID/GID 管到底。这样后面基本就不会再和权限打架了。

作者

薯条

发布于

2026-03-22

更新于

2026-03-22

许可协议

评论