{"id":17980971,"url":"https://github.com/nvidia/ngc-container-replicator","last_synced_at":"2025-03-25T18:30:59.126Z","repository":{"id":35710311,"uuid":"137400565","full_name":"NVIDIA/ngc-container-replicator","owner":"NVIDIA","description":"NGC Container Replicator","archived":false,"fork":false,"pushed_at":"2022-12-26T20:29:38.000Z","size":102,"stargazers_count":28,"open_issues_count":16,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-21T18:01:52.308Z","etag":null,"topics":["containers","deep-learning","nvidia-docker","nvidia-gpus"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NVIDIA.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-14T19:31:41.000Z","updated_at":"2024-09-13T12:45:51.000Z","dependencies_parsed_at":"2023-01-16T03:37:37.578Z","dependency_job_id":null,"html_url":"https://github.com/NVIDIA/ngc-container-replicator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVIDIA%2Fngc-container-replicator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVIDIA%2Fngc-container-replicator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVIDIA%2Fngc-container-replicator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NVIDIA%2Fngc-container-replicator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NVIDIA","download_url":"https://codeload.github.com/NVIDIA/ngc-container-replicator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245519905,"owners_count":20628790,"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":["containers","deep-learning","nvidia-docker","nvidia-gpus"],"created_at":"2024-10-29T18:07:07.816Z","updated_at":"2025-03-25T18:30:58.754Z","avatar_url":"https://github.com/NVIDIA.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NGC Replicator\n\nClones nvcr.io using the either DGX (compute.nvidia.com) or NGC (ngc.nvidia.com)\nAPI keys.\n\nThe replicator will make an offline clone of the NGC/DGX container registry.\nIn its current form, the replicator will download every CUDA container image as\nwell as each Deep Learning framework image in the NVIDIA project.\n\nTarfiles will be saved in `/output` inside the container, so be sure to volume\nmount that directory. In the following example, we will collect our images in\n`/tmp` on the host.\n\nUse `--min-version` to limit the number of versions to download.  In the example\nbelow, we will only clone versions `17.10` and later DL framework images.\n\n```\ndocker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/output \\\n    deepops/replicator --project=nvidia --min-version=17.12 \\\n                       --api-key=\u003cyour-dgx-or-ngc-api-key\u003e\n```\n\nYou can also filter on specific images.\nIf you want to filter only on image names containing the strings \"tensorflow\",\n\"pytorch\", and \"tensorrt\", you would simply add `--image` for each option, e.g.\n\n```\ndocker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/output \\\n    deepops/replicator --project=nvidia --min-version=17.12 \\\n                       --image=tensorflow --image=pytorch --image=tensorrt \\\n                       --dry-run \\\n                       --api-key=\u003cyour-dgx-or-ngc-api-key\u003e\n```\n\nNote: the `--dry-run` option lets you see what will happen without committing\nto a lengthy download.\n\nBy default, the `--image` flag does a substring match in order to ensure you match\nall images that may be desired.\nSometimes, however, you only want to download a specific image with no substring\nmatching.\nIn this case, you can add the `--strict-name-match` flag, e.g.\n\n```\ndocker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/output \\\n    deepops/replicator --project=nvidia --min-version=17.12 \\\n                       --image=tensorflow \\\n                       --strict-name-match \\\n                       --dry-run \\\n                       --api-key=\u003cyour-dgx-or-ngc-api-key\u003e\n```\n\nNote: a `state.yml` file will be created the output directory.  This saved state will be used to\navoid pulling images that were previously pulled.  If you wish to repull and save an image, just\ndelete the entry in `state.yml` corresponding to the `image_name` and `tag` you wish to refresh.\n\n## Kubernetes Deployment\n\nIf you don't already have a `deepops` namespace, create one now.\n\n```\nkubectl create namespace deepops\n```\n\nNext, create a secret with your NGC API Key\n\n```\nkubectl -n deepops create secret generic  ngc-secret\n--from-literal=apikey=\u003cyour-api-key-goes-here\u003e\n```\n\nNext, create a persistent volume claim that will life outside the lifecycle of the CronJob. If\nyou are using [DeepOps](https://github.com/nvidia/deepops) you can use a Rook/Ceph PVC similar\nto:\n\n```\n---\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: ngc-replicator-pvc\n  namespace: deepops\n  labels:\n    app: ngc-replicator\nspec:\n  storageClassName: rook-raid0-retain  # \u003c== Replace with your StorageClass\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 32Mi\n```\n\nFinally, create a `CronJob` that executes the replicator on a schedule.  This\neample run the replicator every hour.  Note: This example used \n[Rook](https://rook.io) block storage to provide a persistent volume to hold the\n`state.yml` between executions.  This ensures you will only download new\ncontainer images. For more details, see our [DeepOps\nproject](https://github.com/nvidia/deepops).\n\n```\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: replicator-config\n  namespace: deepops\ndata:\n  ngc-update.sh: |\n    #!/bin/bash\n    ngc_replicator                                        \\\n      --project=nvidia                                    \\\n      --min-version=$(date +\"%y.%m\" -d \"1 month ago\")     \\\n      --py-version=py3                                    \\\n      --image=tensorflow --image=pytorch --image=tensorrt \\\n      --no-exporter                                       \\\n      --registry-url=registry.local  # \u003c== Replace with your local repo\n---\napiVersion: batch/v1beta1\nkind: CronJob\nmetadata:\n  name: ngc-replicator\n  namespace: deepops\n  labels:\n    app: ngc-replicator\nspec:\n  schedule: \"0 4 * * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          nodeSelector:\n            node-role.kubernetes.io/master: \"\"\n          containers:\n            - name: replicator\n              image: deepops/replicator\n              imagePullPolicy: Always\n              command: [ \"/bin/sh\", \"-c\", \"/ngc-update/ngc-update.sh\" ]\n              env:\n              - name: NGC_REPLICATOR_API_KEY\n                valueFrom:\n                  secretKeyRef:\n                    name: ngc-secret\n                    key: apikey\n              volumeMounts:\n              - name: registry-config\n                mountPath: /ngc-update\n              - name: docker-socket\n                mountPath: /var/run/docker.sock\n              - name: ngc-replicator-storage\n                mountPath: /output\n          volumes:\n            - name: registry-config\n              configMap:\n                name: replicator-config\n                defaultMode: 0777\n            - name: docker-socket\n              hostPath:\n                path: /var/run/docker.sock\n                type: File\n            - name: ngc-replicator-storage\n              persistentVolumeClaim:\n                claimName: ngc-replicator-pvc\n          restartPolicy: Never\n```\n\n## Developer Quickstart\n\n```\nmake dev\npy.test\n```\n\n## TODOs\n\n- [x] save markdown readmes for each image.  these are not version controlled\n- [x] test local registry push service.  coded, beta testing\n- [ ] add templater to workflow\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvidia%2Fngc-container-replicator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvidia%2Fngc-container-replicator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvidia%2Fngc-container-replicator/lists"}