iCloud Picture Downloader Docker Template


Womabre

Recommended Posts

Hi all!

In search of a way to get my iCloud pictures on my array and keep them in sync with iCloud (pull only).

I ended up writing a docker template for the boredazfcuk/icloudpd docker container.

This is my first template so bear with me. If someone has suggestions or comments about it please let me know!

 

The template is located here.

https://github.com/Womabre/unraid-docker-templates

 

Known issues

 

- Your iCloud password cannot contain special characters (I know of * and & to be problematic).

 

  • Thanks 2
Link to comment
  • 3 months later...

Did you create a .mounted file?

Quote

 

VOLUME CONFIGURATION

It also requires a named volume mapped to /config. This is where is stores the authentication cookie. Without it, it will lose the cookie information each time the container is recreated. It will download the photos to the "/home/${user}/iCloud" photos directory. You need to create a bind mount into the container at this point

I also have a failsafe built in. The launch script will look for a file called .mounted in the "/home/${user}/iCloud" folder. If this file is not present, it will not sync with iCloud. This is so that if the underlying disk/volume/whatever gets unmounted, sync will not occur. This prevents the script from filling up the root volume if the underlying volume isn't mounted for whatever reason. This file MUST be created manually and sync will not start without it

https://hub.docker.com/r/boredazfcuk/icloudpd

Link to comment

I created the mounted file, but now I am getting some strange errors: 

 

last):
-bash: syntax error near unexpected token `)'
root@Tower:~#   File "/usr/bin/icloudpd", line 11, in <module>
-bash: syntax error near unexpected token `newline'
root@Tower:~#     load_entry_point('icloudpd==1.5.0', 'console_scripts', 'icloudpd')()
-bash: syntax error near unexpected token `'icloudpd==1.5.0','
root@Tower:~#   File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 722, in __call__
-bash: File: command not found
root@Tower:~#     return self.main(*args, **kwargs)
-bash: syntax error near unexpected token `('
root@Tower:~#   File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 697, in main
-bash: File: command not found
root@Tower:~#     rv = self.invoke(ctx)
-bash: syntax error near unexpected token `('
root@Tower:~#   File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 895, in invoke
-bash: File: command not found
root@Tower:~#     return ctx.invoke(self.callback, **ctx.params)
-bash: syntax error near unexpected token `('
root@Tower:~#   File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 535, in invoke
-bash: File: command not found
root@Tower:~#     return callback(*args, **kwargs)
-bash: syntax error near unexpected token `('
root@Tower:~#   File "/usr/lib/python3.8/site-packages/icloudpd-1.5.0-py3.8.egg/icloudpd/base.py", line 292, in main
-bash: File: command not found
root@Tower:~#   File "/usr/lib/python3.8/posixpath.py", line 336, in norm

 

 

Any thoughts? 

Link to comment
On 5/14/2020 at 11:22 PM, Womabre said:

Did you create a .mounted file?

https://hub.docker.com/r/boredazfcuk/icloudpd

I have created this file ".mounted" placed it w/in my /mnt/user/media/pictures/iCloud/ directory. Still seeing the same error.

When I bash into the container I navigate to /home/user/icloud/ I can see the .mounted file there. after running ls -A to see the hidden file.

Destination volume not mounted - retry in 5 minutes

My docker command:

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='icloudpd' --net='bridge' -e TZ="America/Los_Angeles" -e HOST_OS="Unraid" -e 'apple_id'='[email protected]' -e 'apple_password'='PASSWORD' -e 'synchronisation_interval'='21600' -e 'command_line_options'='' -e 'authentication_type'='2FA' -e 'UMASK'='000' -e 'directory_permissions'='777' -e 'file_permissions'='666' -e 'notification_type'='' -e 'prowl_api_key'='' -e 'pushbullet_api_key'='' -e 'telegram_token'='' -e 'telegram_chat_id'='' -e 'PUID'='99' -e 'PGID'='100' -e 'TZ'='America/Los Angeles' -v '/mnt/user/appdata/icloudpd':'/config':'rw' -v '/mnt/user/media/pictures/iCloud/':'/home/user/icloud':'rw' 'boredazfcuk/icloudpd' 

EDIT: got it working change mapping for /home/user/icloud to /home/user/iCloud , the capital C does make a difference. 
 

Edited by Drazzilb
Link to comment
On 2/3/2020 at 8:53 PM, Womabre said:

Known issues

 

- Your iCloud password cannot contain special characters (I know of * and & to be problematic).

 

Think I've fixed this today. I've tested with * and & and that works OK.

 

I've not tried others like "$()'<> which may cause issues though.

Link to comment
6 hours ago, principino1984 said:

I had to run the docker configuration manually cause the automatic from CA is not mapping correctly the "iCloud" name too. But now I have another problem when I start it:

 

"Error: Invalid value for "-d" / "--directory": Path "/home//iCloud" does not exist"

I'm getting this error as well since the update last night.

@boredazfcuk maybe this is something that has to do with changes on your end?

Link to comment
8 hours ago, principino1984 said:

I had to run the docker configuration manually cause the automatic from CA is not mapping correctly the "iCloud" name too. But now I have another problem when I start it:

 

"Error: Invalid value for "-d" / "--directory": Path "/home//iCloud" does not exist"

Also getting this error.

Link to comment

Looks like the character ! is an issue in passwords?

 

When filling in the following command and running it i get a bash error

"docker run -it --rm --network host --env user=user --env user_id=1000 --env group=admins --env group_id=1010 --env apple_id="my@apple_id.com" --env apple_password="PASSWORD" --volume /mnt/user/appdata/icloudpd:/config boredazfcuk/icloudpd"

 

-bash: !ng: event not found

 

"!ng" is a small part of my password, trying to escape the ! with a backslash (\!ng) within the password string allows it to work but then i all sorts of other python errors. The scrips thinks it completed as it says 2FA cookie is generated but the log for the docker gets stuck at "Check 2FA Cookie"

 

2020-05-19 18:22:36 DEBUG    Authenticating...
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pyicloud_ipd/base.py", line 209, in authenticate
    req = self.session.post(
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3.8/site-packages/pyicloud_ipd/base.py", line 100, in request
    self._raise_error(code, reason)
  File "/usr/lib/python3.8/site-packages/pyicloud_ipd/base.py", line 122, in _raise_error
    raise api_error
pyicloud_ipd.exceptions.PyiCloudAPIResponseError: Unknown reason

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/icloudpd", line 11, in <module>
    load_entry_point('icloudpd==1.5.0', 'console_scripts', 'icloudpd')()
  File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/icloudpd-1.5.0-py3.8.egg/icloudpd/base.py", line 253, in main
  File "/usr/lib/python3.8/site-packages/icloudpd-1.5.0-py3.8.egg/icloudpd/authentication.py", line 29, in authenticate
  File "/usr/lib/python3.8/site-packages/pyicloud_ipd/base.py", line 193, in __init__
    self.authenticate()
  File "/usr/lib/python3.8/site-packages/pyicloud_ipd/base.py", line 216, in authenticate
    raise PyiCloudFailedLoginException(msg, error)
pyicloud_ipd.exceptions.PyiCloudFailedLoginException: ('Invalid email/password combination.', PyiCloudAPIResponseError('Unknown reason'))
2020-05-19 18:22:37 INFO     Please ignore the 'expected str, bytes or os.PathLike object, not NoneType' error. This is a fault with the underlying icloud_photos_downloader Python application
2020-05-19 18:22:37 INFO     Two factor authentication cookie generated. Sync should now be successful.

Link to comment

Looking for some thoughts in regards to this warning. not really an error. Just curious how I can make it right.

 

WARNING Using Apple ID password from variable. This password will be visible in the process list of the host. Please add your password to the system keyring instead
 

 

Thanks

Link to comment

Thank you for creating this! I have always wanted a way to do this!

 

Now a quick question: Setup has worked, I can see in the log how it is listing file after file of my iCloud photos. It seems to be only creating folders, without actually saving any files. Is there a setting somewhere that I missed? Have you ever experienced this?

 

In the log it will list the following for example:

 

home/user/iCloud/2020/02/20/IMG_7207.HEIC
/home/user/iCloud/2020/02/19/8ea11b5c-f26b-4d93-96c3-c6a037ee01dd.jpg
/home/user/iCloud/2020/02/18/2ac47d72-f515-4b26-b975-bdae319f1b52.jpg
/home/user/iCloud/2020/02/19/ec6770bc-b98c-422a-a602-d459f7272189.jpg
/home/user/iCloud/2020/02/19/IMG_7202.HEIC
/home/user/iCloud/2020/02/19/43cf780a-d9a6-4fbf-874f-d1ce19d465dc.jpg
/home/user/iCloud/2020/02/20/5ba84dce-c350-4355-8a71-9e02f7355176.jpg
/home/user/iCloud/2020/02/19/IMG_7203.HEIC
/home/user/iCloud/2020/02/19/2bf9c153-ba57-4a59-8eee-8dca104342e6.jpg
 

 

thank you!

Edited by Yoram
Link to comment
  • 2 weeks later...
On 5/24/2020 at 7:21 PM, Yoram said:

Now a quick question: Setup has worked, I can see in the log how it is listing file after file of my iCloud photos. It seems to be only creating folders, without actually saving any files. Is there a setting somewhere that I missed? Have you ever experienced this?

 

In the log it will list the following for example:

 

home/user/iCloud/2020/02/20/IMG_7207.HEIC
/home/user/iCloud/2020/02/19/8ea11b5c-f26b-4d93-96c3-c6a037ee01dd.jpg
/home/user/iCloud/2020/02/18/2ac47d72-f515-4b26-b975-bdae319f1b52.jpg
/home/user/iCloud/2020/02/19/ec6770bc-b98c-422a-a602-d459f7272189.jpg
/home/user/iCloud/2020/02/19/IMG_7202.HEIC
/home/user/iCloud/2020/02/19/43cf780a-d9a6-4fbf-874f-d1ce19d465dc.jpg
/home/user/iCloud/2020/02/20/5ba84dce-c350-4355-8a71-9e02f7355176.jpg
/home/user/iCloud/2020/02/19/IMG_7203.HEIC
/home/user/iCloud/2020/02/19/2bf9c153-ba57-4a59-8eee-8dca104342e6.jpg

If I'm not mistaking it first scans and creates the folder structure. After this is done it will download the files.

Link to comment
  • 1 month later...

Thanks so much for this @Womabre. Been looking for something like this for ages!

 

I've had this up and running no troubles for a few weeks but in the last couple of days I've started getting the following error.

 

Traceback (most recent call last):
File "/usr/bin/icloudpd", line 11, in <module>
load_entry_point('icloudpd==1.5.0', 'console_scripts', 'icloudpd')()
File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/icloudpd-1.5.0-py3.8.egg/icloudpd/base.py", line 276, in main
File "/usr/lib/python3.8/site-packages/pyicloud_ipd/services/photos.py", line 194, in albums
folder['fields']['albumNameEnc']['value']).decode('utf-8')
KeyError: 'albumNameEnc'
2020-07-14 15:43:47 ERROR Check failed - Exit code: 1

I'm not sure what's happened as i don't think I've changed anything? Server restarted one day and now throwing this error. Any ideas?

Link to comment
13 hours ago, Womabre said:

Maybe an album with a special character that causes issues??

See..... @Womabre this is why you earn the big bucks. I humbly submit my thanks and appreciation!

Somehow I had created a Folder in Albums with no name. Did not show up on my iphone or ipad but it did show up on my mac. Renamed it and that's fixed it. Really appreciate your time in responding, i wouldn't have come across that for weeks as i don't use the Photos app on mac to edit my photos.

 

Cheers!

Link to comment
  • 1 month later...
  • 1 month later...

Hi,

I´m trying to config docker but i can´t.

 

I create the docker.

I put these variables: "condig:dir" = "/config", "PATH"="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "apple_id"="***@gmail.com", "user"="Veronica", "user_id"="502", "TZ"="Europe/Madrid"

 

In Network i put "host"

And in share folder, host volume. I put \Container\iCloudBackup and in mounted point /Config

 

When I run docker, it ask me 2FA authentification and I put it right

"2020-10-06 12:38:03 INFO     Two factor authentication cookie generated. Sync should now be successful.  "

But docker stop

 

Can anyone help me?

 

Thanks

Edited by DBGrandes
Link to comment
19 hours ago, DBGrandes said:

Hi,

I´m trying to config docker but i can´t.

 

I create the docker.

I put these variables: "condig:dir" = "/config", "PATH"="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "apple_id"="***@gmail.com", "user"="Veronica", "user_id"="502", "TZ"="Europe/Madrid"

 

In Network i put "host"

And in share folder, host volume. I put \Container\iCloudBackup and in mounted point /Config

 

When I run docker, it ask me 2FA authentification and I put it right

"2020-10-06 12:38:03 INFO     Two factor authentication cookie generated. Sync should now be successful.  "

But docker stop

 

Can anyone help me?

 

Thanks

I've just updated the containers template to work with keyring authentications by default.

This way it is a lot easier to configure. Can you try to create the container again using the new template?

 

At minimum you need to provide you Apple ID and configure the "Data" path.

Also make sure to place the ".mounted" file in this folder. For info check: https://hub.docker.com/r/boredazfcuk/icloudpd/

Edited by Womabre
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.