{"id":16536538,"url":"https://github.com/tillahoffmann/universal_tensorflow_image","last_synced_at":"2025-07-12T15:12:09.484Z","repository":{"id":83884104,"uuid":"134001166","full_name":"tillahoffmann/universal_tensorflow_image","owner":"tillahoffmann","description":"Develop tensorflow models with or without a GPU accelerator using the same Docker image. 🥳","archived":false,"fork":false,"pushed_at":"2019-07-21T21:00:42.000Z","size":3,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T20:04:12.212Z","etag":null,"topics":["cuda","nvidia-docker","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tillahoffmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-05-18T20:29:08.000Z","updated_at":"2023-07-13T07:29:01.000Z","dependencies_parsed_at":"2023-03-12T03:15:30.971Z","dependency_job_id":null,"html_url":"https://github.com/tillahoffmann/universal_tensorflow_image","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tillahoffmann/universal_tensorflow_image","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tillahoffmann%2Funiversal_tensorflow_image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tillahoffmann%2Funiversal_tensorflow_image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tillahoffmann%2Funiversal_tensorflow_image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tillahoffmann%2Funiversal_tensorflow_image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tillahoffmann","download_url":"https://codeload.github.com/tillahoffmann/universal_tensorflow_image/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tillahoffmann%2Funiversal_tensorflow_image/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265009249,"owners_count":23697157,"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":["cuda","nvidia-docker","tensorflow"],"created_at":"2024-10-11T18:31:59.251Z","updated_at":"2025-07-12T15:12:09.479Z","avatar_url":"https://github.com/tillahoffmann.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# universal_tensorflow_image\n\nDevelop tensorflow models with or without a GPU accelerator using the same Docker image. 🥳\n\nUse\n\n* `docker build -t universal-tensorflow-image .` to build the image\n* `docker run --rm --runtime=nvidia universal-tensorflow-image python3 test_tensorflow.py` to test tensorflow using the GPU\n* `docker run --rm universal-tensorflow-image python3 test_tensorflow.py` to test tensorflow using the CPU\n\nNote that the only difference between the CPU and GPU run is the runtime.\n\n## Background\n\nDocker images for tensorflow commonly come in [two flavours](https://hub.docker.com/r/tensorflow/tensorflow/#optional-features):\n\n* one to develop on machines without a GPU accelerator, e.g. [`cpu.Dockerfile`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/dockerfiles/dockerfiles/cpu.Dockerfile),\n* and one to develop on machines with a GPU accelerator, e.g. [`gpu.Dockerfile`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/dockerfiles/dockerfiles/gpu.Dockerfile).\n\nMaintaining two images in parallel is both cumbersome and increases the risk of discrepancies between different runtime environments.\n\nThe [`Dockerfile`](https://github.com/tillahoffmann/universal_tensorflow_image/blob/master/Dockerfile) provides a universal setup so you can use the same image irrespective of whether you're using a GPU or not. It installs [`tensorflow-gpu`](https://pypi.org/project/tensorflow-gpu/) and [symlinks](https://en.wikipedia.org/wiki/Symbolic_link) the required CUDA library stubs to the location where tensorflow expects to find them. That means `tensorflow-gpu` can be used even if you start a container based on the image without using the [nvidia runtime](https://github.com/NVIDIA/nvidia-docker). When you use the nvidia runtime, the stubs are overwritten by the real libraries and you can access the GPU seamlessly.\n\nYou may want to stick to a setup with two different images if you care about the size of your images: the universal tensorflow image has the same size as the GPU image. The CPU image is substantially smaller.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftillahoffmann%2Funiversal_tensorflow_image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftillahoffmann%2Funiversal_tensorflow_image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftillahoffmann%2Funiversal_tensorflow_image/lists"}