{"id":15195313,"url":"https://github.com/borisboc/docker_tensorflow_spyder","last_synced_at":"2026-03-08T02:03:44.869Z","repository":{"id":255639692,"uuid":"852659625","full_name":"borisboc/docker_tensorflow_spyder","owner":"borisboc","description":"How to build a Docker container with tensorflow, Spyder IDE, jupyter etc. With GPU support !","archived":false,"fork":false,"pushed_at":"2024-09-05T13:06:56.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T18:56:40.695Z","etag":null,"topics":["docker","gpu","jupyter","jupyter-notebook","jupyterlab","nvidia-docker","nvidia-gpu","spyder","spyder-ide","tensorflow","tensorflow2"],"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/borisboc.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":"2024-09-05T07:37:45.000Z","updated_at":"2024-09-05T13:06:59.000Z","dependencies_parsed_at":"2024-09-11T12:31:21.265Z","dependency_job_id":null,"html_url":"https://github.com/borisboc/docker_tensorflow_spyder","commit_stats":null,"previous_names":["borisboc/docker_tensorflow_spyder"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/borisboc/docker_tensorflow_spyder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisboc%2Fdocker_tensorflow_spyder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisboc%2Fdocker_tensorflow_spyder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisboc%2Fdocker_tensorflow_spyder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisboc%2Fdocker_tensorflow_spyder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borisboc","download_url":"https://codeload.github.com/borisboc/docker_tensorflow_spyder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borisboc%2Fdocker_tensorflow_spyder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30242403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","gpu","jupyter","jupyter-notebook","jupyterlab","nvidia-docker","nvidia-gpu","spyder","spyder-ide","tensorflow","tensorflow2"],"created_at":"2024-09-27T23:21:26.766Z","updated_at":"2026-03-08T02:03:44.850Z","avatar_url":"https://github.com/borisboc.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker container with tensorflow, jupyter and Spyder IDE \n\nHow to build a Docker container with tensorflow, Spyder IDE, jupyter etc. With GPU support !\n\nBased on docker image [tensorflow/tensorflow:latest-gpu-jupyter](https://hub.docker.com/r/tensorflow/tensorflow/tags?page=\u0026page_size=\u0026ordering=\u0026name=latest-gpu-jupyter).\n\nStrongly inspired by [caliari-italo and dalthviz on issue 17542](https://github.com/spyder-ide/spyder/issues/17542). And [spyder workflow for linux tests](https://github.com/spyder-ide/spyder/blob/master/external-deps/qtconsole/.github/workflows/linux-tests.yml).\nThank you guys !\n\n## Requirements\n\nThis is for Linux only.\nTested on Ubuntu 22.04.\n\nFollow [tensorflow docker requirements](https://www.tensorflow.org/install/docker#tensorflow_docker_requirements).\n\nSince we want to use GPU, also follow the [NVIDIA container toolkit installation guide](https://docs.nvidia.com/datace.nter/cloud-native/container-toolkit/latest/install-guide.html).\n\nTo do so, you will have to follow the [CUDA installation guide for Linux](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/).\n\nTo test the requirements, you should be able to run :\n\n```\nsudo docker run --runtime=nvidia --gpus all -it --rm tensorflow/tensorflow:latest-gpu-jupyter nvidia-smi\n```\n\nwhich should return something like : \n\n```\nSun Sep  1 08:44:19 2024       \n+-----------------------------------------------------------------------------------------+\n| NVIDIA-SMI 560.35.03              Driver Version: 560.35.03      CUDA Version: 12.6     |\n|-----------------------------------------+------------------------+----------------------+\n| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |\n| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |\n|                                         |                        |               MIG M. |\n|=========================================+========================+======================|\n|   0  NVIDIA GeForce RTX 3060        Off |   00000000:07:00.0  On |                  N/A |\n|  0%   50C    P8             19W /  170W |     512MiB /  12288MiB |      2%      Default |\n|                                         |                        |                  N/A |\n+-----------------------------------------+------------------------+----------------------+\n                                                                                         \n+-----------------------------------------------------------------------------------------+\n| Processes:                                                                              |\n|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |\n|        ID   ID                                                               Usage      |\n|=========================================================================================|\n|  No running processes found                                                             |\n+-----------------------------------------------------------------------------------------+\n```\n\nWhere your GPU card is visible (`NVIDIA GeForce RTX 3060` in my case, please feel free to send me a newer one :wink:).\nRemark : this may work currently but may fail after some hours / reboots. See troubleshooting section.\n\n\nYou should also be able to run : \n\n```\nsudo docker run --runtime=nvidia --gpus all -it --rm tensorflow/tensorflow:latest-gpu-jupyter    python -c \"from tensorflow.python.client import device_lib ; import tensorflow as tf ; print('devices found:\\n',tf.config.list_physical_devices('GPU'))\"\n```\n\nwhich should output something like :\n\n```\ndevices found:\n [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]\n```\n\n(with a lot of warnings in my case, such as `Unable to register cuDNN factor` etc.)\n\nIf so, you should have the requirements properly working.\n\nNOTE : yes we need to sudo the docker commands. I have not configure rootless mode so far.\n\n\n## Building the container\n\n```\nsudo docker build -t tensorflow_spyder .\n```\n\n## Running the container\n\nFirst activate X forwarding between your local and the container\n\n```\nxhost +local:docker\n```\n\nThen start a container with all these arguments \n\n```\nsudo docker run --runtime=nvidia --gpus all -it -e DISPLAY=$DISPLAY --net=host -v /tmp/.X11-unix:/tmp/.X11-unix -v $PWD:/home --rm tensorflow_spyder spyder\n```\n\nTo start your container and Spyder IDE.\n\nYou can also start a bash (instead of spyder) and interact as you want within your container. But personnaly, I wasn't able to run `spyder \u0026` (it stucks at \"Loading Code Analysis...\")\n\nSince this container is based on docker image [tensorflow/tensorflow:latest-gpu-jupyter](https://hub.docker.com/r/tensorflow/tensorflow/tags?page=\u0026page_size=\u0026ordering=\u0026name=latest-gpu-jupyter), you can also refere to [tensorflow documentation concerning docker](https://www.tensorflow.org/install/docker).\n\nFor instance, to start a container with jupyter running : \n```\nsudo docker run --runtime=nvidia --gpus all -it -e DISPLAY=$DISPLAY --net=host -v /tmp/.X11-unix:/tmp/.X11-unix -v $PWD:/home -p 8888:8888 --rm tensorflow_spyder\n```\n\n\n## Troubleshooting\n\n### Failed to initialize NVML: Unknown Error\n\nEventhough you maybe able to currently run nvidia-smi in you container, you may get error \"Failed to initialize NVML: Unknown Error\" after some hours / reboots.\n\nI found the solution on [stackoverflow : Failed to initialize NVML: Unknown Error in Docker after Few hours](https://stackoverflow.com/a/78137688). I sudo edited `/etc/nvidia-container-runtime/config.toml`, to change `no-cgroups = false`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborisboc%2Fdocker_tensorflow_spyder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborisboc%2Fdocker_tensorflow_spyder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborisboc%2Fdocker_tensorflow_spyder/lists"}