{"id":18779168,"url":"https://github.com/trisongz/tpu-vm-docker-containers","last_synced_at":"2025-04-13T11:27:47.307Z","repository":{"id":70974866,"uuid":"375922994","full_name":"trisongz/tpu-vm-docker-containers","owner":"trisongz","description":"Docker File Templates to access TPUs within TPU VM in Containers","archived":false,"fork":false,"pushed_at":"2021-06-11T06:11:42.000Z","size":3,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T02:39:17.565Z","etag":null,"topics":["docker-compose","docker-container","google-cloud-platform","machine-learning","tpu"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","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/trisongz.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-11T06:11:38.000Z","updated_at":"2024-04-01T11:15:03.000Z","dependencies_parsed_at":"2023-03-18T05:30:30.697Z","dependency_job_id":null,"html_url":"https://github.com/trisongz/tpu-vm-docker-containers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trisongz%2Ftpu-vm-docker-containers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trisongz%2Ftpu-vm-docker-containers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trisongz%2Ftpu-vm-docker-containers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trisongz%2Ftpu-vm-docker-containers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trisongz","download_url":"https://codeload.github.com/trisongz/tpu-vm-docker-containers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248705039,"owners_count":21148475,"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":["docker-compose","docker-container","google-cloud-platform","machine-learning","tpu"],"created_at":"2024-11-07T20:19:02.632Z","updated_at":"2025-04-13T11:27:47.277Z","avatar_url":"https://github.com/trisongz.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Accessing TPUs in Docker Containers with TPU VM\n Docker File Templates to access TPUs within TPU VM in Containers\n\nThis Github repo accompanies the [Medium Post](https://trisongz.medium.com/accessing-your-tpus-in-docker-containers-with-tpu-vm-e944f5909dd4) about how to get your containers to access the TPU directly in TPU VMs\n\n## The Important Pieces\n\nBelow is the most important configs in the docker-compose.yaml file that you'll need to include in your specific container that is accessing the TPU. \n\n```yaml\ncap_add:\n    - ALL #unsure if necessary\nenvironment:\n    - TPU_NAME=tpu_name\n    - TF_CPP_MIN_LOG_LEVEL=0\n    - XRT_TPU_CONFIG=\"localservice;0;localhost:51011\"\n    - TF_XLA_FLAGS=--tf_xla_enable_xla_devices\nvolumes:\n    - /var/run/docker.sock:/var/run/docker.sock #unsure if necessary\n    - /usr/share/tpu/:/usr/share/tpu/\n    - /lib/libtpu.so:/lib/libtpu.so\nprivileged: true\ndevices:\n    - \"/dev:/dev\"\n```\n\nIncluded are a few Dockerfiles to help make sure google-cloud-sdk are installed with the service account that TPU VM is configured with.\n\nAfter configuring your Dockerfile, docker-compose and tpu.env, you should be able to run\n\n```bash\ndocker-compose -f docker-compose.yaml --env-file=tpu.env up # -d for daemon\n```\n\nIf you this repository helpful, I'd appreciate a star, a fork, or even sharing it!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrisongz%2Ftpu-vm-docker-containers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrisongz%2Ftpu-vm-docker-containers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrisongz%2Ftpu-vm-docker-containers/lists"}