{"id":13572500,"url":"https://github.com/JakeWharton/docker-gphotos-sync","last_synced_at":"2025-04-04T10:30:39.868Z","repository":{"id":43149027,"uuid":"239020995","full_name":"JakeWharton/docker-gphotos-sync","owner":"JakeWharton","description":"A Docker image for synchronizing your original-quality Google Photos","archived":false,"fork":false,"pushed_at":"2024-04-27T14:02:15.000Z","size":47,"stargazers_count":428,"open_issues_count":14,"forks_count":38,"subscribers_count":18,"default_branch":"trunk","last_synced_at":"2024-10-30T18:07:13.096Z","etag":null,"topics":["backup","docker","google-photos"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/jakewharton/gphotos-sync","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JakeWharton.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-07T20:55:57.000Z","updated_at":"2024-10-21T09:22:42.000Z","dependencies_parsed_at":"2024-04-27T15:22:33.868Z","dependency_job_id":"c77289eb-57da-4cb0-a928-241603174090","html_url":"https://github.com/JakeWharton/docker-gphotos-sync","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeWharton%2Fdocker-gphotos-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeWharton%2Fdocker-gphotos-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeWharton%2Fdocker-gphotos-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JakeWharton%2Fdocker-gphotos-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JakeWharton","download_url":"https://codeload.github.com/JakeWharton/docker-gphotos-sync/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223123768,"owners_count":17091169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","docker","google-photos"],"created_at":"2024-08-01T14:01:25.300Z","updated_at":"2024-11-05T05:31:25.719Z","avatar_url":"https://github.com/JakeWharton.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"Docker GPhotos Sync\n===================\n\nA Docker container which runs the [`gphoto-cdp`][1] tool automatically to synchronize your Google Photos (in original quality!).\n\n [1]: http://github.com/perkeep/gphotos-cdp\n\n[![Docker Image Version](https://img.shields.io/docker/v/jakewharton/gphotos-sync?sort=semver)][hub]\n[![Docker Image Size](https://img.shields.io/docker/image-size/jakewharton/gphotos-sync)][hub]\n\n [hub]: https://hub.docker.com/r/jakewharton/gphotos-sync/\n\n\nMotivation\n----------\n\nYour photos are too valuable to leave solely in Google's hands. While it's extremely unlikely that Google would ever lose data, it's far more likely for you to lose access to your account (for whatever reason).\n\nCurrently, the only way to obtain original backups of your photos is through Google Takeout. Obtaining this backup is a tedious, manual process which is also not incremental.\n\nGoogle Photos does have an API making traditional incremental backup feasible, but you do not have access to the original image making it a lossy solution.\n\nThe [`gphoto-cdp`][1] tool uses the Chrome Devtools Protocol to drive the normal web interface of Google Photos to download orignial copies in an incremental fashion. This repository is a Docker-ized version of the tools which runs it on a periodic basis.\n\n\nSetup\n-----\n\nSelect and create two directories:\n\n * The \"download\" directory where images will be stored. (From now on referred to as `/path/to/download`)\n * The \"config\" directory where your Google account authentication credentials will be stored. (From now on referred to as `/path/to/config`)\n\n\n### Sign In\n\nIn order for the headless, automatic sync to work, you need to first authenticate with your Google account.\n\n#### Linux\n\nOpen a terminal and run the following command.\n```\nchromium-browser --user-data-dir=/path/to/config https://photos.google.com\n```\n\nClick \"Go to photos\" and sign in to your Google account. You are free to use your real password or to create an app-specific password.\n\nClose the Chrome window. You're done!\n\n#### MacOS / Windows\n\nTo do this, we start a Linux-based Docker container with Chrome and remotely sign in.\n\nIn a terminal, run the following command, replacing `/path/to/config` with your chosen \"config\" directory.\n```bash\n$ docker run -p 6080:80 \\\n    -v /path/to/config:/config \\\n    dorowu/ubuntu-desktop-lxde-vnc\n```\n\nVisit http://localhost:6080 (or http://server-ip:6080 if running on a remote machine) which will connect to the container's desktop.\n\nInside the container desktop, click on the menu (lower left icon), go to \"System Tools\", and select \"LXTerminal\".\nRun the following command.\n```bash\ngoogle-chrome --user-data-dir=/config --no-sandbox https://photos.google.com\n```\n(Note: Do not change the `/config` path!)\n\nClick \"Go to photos\" and sign in to your Google account. You are free to use your real password or to create an app-specific password.\n\nClose the Chrome window inside the container desktop.\n\nClose your browser's tab.\n\nPress CTRL+C to quit the Docker image. You're done!\n\n\n### Initial Sync\n\nThe first time this container runs, it will start from your oldest photo and cycle its way to your newest, downloading each along the way.\nThis is a _very_ slow operation that will take many hours or even days. Yes, days. In the process it will download tens or hundreds of gigabytes of images.\n\nIt is not required, but if you'd like to run this sync manually you can choose to do so.\nThis allows you to temporarily interrupt it at any point and also intervene if it gets stuck.\n\n```bash\n$ docker run -it --rm\n    -v /path/to/config:/tmp/gphotos-cdp \\\n    -v /path/to/downloads:/download \\\n    jakewharton/gphotos-sync:trunk \\\n    /app/sync.sh\n```\n\nThis will run until all photos have been downloaded. At this point, you should set it up to run automatically on a schedule.\n\n\n### Running Automatically\n\nTo run the sync automatically on a schedule, pass a valid cron specifier as the `CRON` environment variable.\n\n```bash\n$ docker run -it --rm\n    -v /path/to/config:/tmp/gphotos-cdp \\\n    -v /path/to/download:/download \\\n    -e \"CRON=0 * * * *\" \\\n    jakewharton/gphotos-sync:trunk\n```\n\nThe above version will run every hour and download any new photos. For help creating a valid cron specifier, visit [cron.help][2].\n\n [2]: https://cron.help/#0_*_*_*_*\n\n\n### More\n\nTo be notified when sync is failing visit https://healthchecks.io, create a check, and specify the ID to the container using the `HEALTHCHECK_ID` environment variable.\n\nBecause the sync can occasionally fail, it's best to set a grace period on the check which is a multiple of your cron period. For example, if you run sync hourly give a grace period of two hours.\n\nTo write data as a particular user, the `PUID` and `PGID` environment variables can be set to your user ID and group ID, respectively.\n\n\n### Diagnosing Blockages\n\nThe script will occasionally fail to download an image or video. This usually isn't something to worry about and it will resume when retried (either manually or automatically).\n\nSometimes, however, the script will get stuck on a single item and be unable to make progress. Usually this item will be a video.\n\nWhen this happens, open the last Google Photos link from the logs. This is the last successful item that was download. Pressing the left arrow will move forward in time to the offending item. If you click \"Download\" in the three-dot menu and the item downloads then keep trying the sync. But if it fails to download, there is something wrong on Google's side. The only recourse is to delete the image or video. This will allow the script to continue on its next run.\n\nDeleting an image or video should be a last resort. Retry at least 5 times, potentially waiting an hour or two in between. You can also get a Google Takeout of your Photos data and look for the item in the resulting archives.\n\n\n### Docker Compose\n\n```yaml\nversion: '2'\nservices:\n  gphotos-sync:\n    image: jakewharton/gphotos-sync:latest\n    restart: unless-stopped\n    volumes:\n      - /path/to/config:/tmp/gphotos-cdp\n      - /path/to/download:/download\n    environment:\n      - \"CRON=0 * * * *\"\n      #Optional:\n      - \"HEALTHCHECK_ID=...\"\n      - \"PUID=...\"\n      - \"PGID=...\"\n```\n\nNote: You may want to specify an explicit version rather than `latest`.\nSee https://hub.docker.com/r/jakewharton/gphotos-sync/tags.\n\n\nDevelopment\n-----------\n\nWith Docker installed, `docker build .` will give you a SHA that you can use.\n```\n$ docker build .\n...\nSuccessfully built 7b431e7e9868\n```\n\nUse that SHA in place of `jakewharton/gphotos-sync` in the commands above to manually test.\n\n\n\nLICENSE\n======\n\nMIT. See `LICENSE.txt`.\n\n    Copyright 2020 Jake Wharton\n\nThe Chrome installation in the `Dockerfile` is from [Zenika/alpine-chrome][3].\n`jhead` installation from [sourcelevel/engine-image-optim][4]\n\n [3]: https://github.com/Zenika/alpine-chrome\n [4]: https://github.com/sourcelevel/engine-image-optim\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJakeWharton%2Fdocker-gphotos-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJakeWharton%2Fdocker-gphotos-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJakeWharton%2Fdocker-gphotos-sync/lists"}