Jump to content
Womabre

iCloud Picture Downloader Docker Template

17 posts in this topic Last Reply

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).

 

Share this post


Link to post

Hey! 

 

I just found this - it's exactly what I need! I used to boot up my macOS VM and have to manually export the images.... 

 

I am not able to run it, it has the following error: 

 

2020-05-15 04:46:51 ERROR Destination volume not mounted - retry in 5 minutes
 

Share this post


Link to post

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

Share this post


Link to post

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? 

Share this post


Link to post
Posted (edited)
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'='USERNAME@icloud.com' -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

Share this post


Link to post
8 hours ago, Drazzilb said:

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

Thanks! I will adjust the default value to be with a capital C.

Share this post


Link to post
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.

Share this post


Link to post

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"

Share this post


Link to post
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?

Share this post


Link to post
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.

Share this post


Link to post

Same. Seems to be a new issue 

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

Share this post


Link to post

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.

Share this post


Link to post
On 5/18/2020 at 5:48 PM, Lasbo55 said:

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

This error seems to be fixed in the update from last night.

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

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.