Setting up icloudpd on Synology NAS
Last Updated on 12/11/2024
In this article I document how I setup backups for iCloud library in a Synology NAS (ds923+ to be precise).
Out of all the solutions out there, I opted to have a copy in my NAS rather than moving everything to it. And I wanted a way that needs minimal recurring effort. So went with icloudpd
docker container which would directly download stuff from iCloud. I don't have to keep originals on my phone and wait to get home to have the backed up.
This was a lot figure out.
The repo - https://github.com/boredazfcuk/docker-icloudpd
Setting up the filesystem
Initially, we need to create 2 directories. One for the container settings and one for the location of downloads.
In /docker
, the default directory Container Manager
creates, I create icloudpd/config
directory so that the container can create the settings.
For the download path, I use volume1/homes/<user>/Photos/icloud
so Synology Photos
has access to the downloaded media.
Setting up the docker image
We need to create a new project with the path as the /docker/icloudpd
and the following docker-compose
yml1version: '3.3'2services:3 icloudpd:4 container_name: icloudpd5 restart: always6 environment:7 - user=username8 - user_id=1026 # default9 - group=users # default10 - group_id=100 #default11 - apple_id=apple-user@icloud.com12 - authentication_type=2FA13 - 'folder_structure={:%Y/%m}'14 - notification_days=315 - synchronisation_interval=2160016 - TZ=Asia/Calcutta17 - 'download_path=/icloud'18 - skip_check=false19 network_mode: host20 healthcheck:21 test: ["CMD", "/usr/local/bin/healthcheck.sh"]22 interval: 10m23 timeout: 10s24 retries: 325 start_period: 2m26 volumes:27 - '/volume1/docker/icloudpd/config:/config'28 - '/volume1/homes/user/Photos/icloud:/icloud'29 image: boredazfcuk/icloudpd:latest30
Figuring out user_id
and group details was a chore. It would not get proper permissions to download without this. After some debugging here's what worked
- SSH into your NAS
- Run
id username
As soon as, you setup the docker container, you would need to setup a few things like the failsafe file and authentication. This was convenient to setup from the terminal as I was ssh-ed into it already.
- SSH into your NAS (if you already haven't)
touch <download-path>/.mounted
- this is the failsafe filedocker exec -it icloudpd sync-icloud.sh --Initialise
- this would initiate the iCloud authentication
Ran into few issues and one of the error messages suggested I login in icloud.com and see if there are any popups on screen. After clicking them away and re-running the container, it seems to download the icloud library.
By Aravind Balla, a Javascript Developer building things to solve problems faced by him & his friends. You should hit him up on Twitter!