{"id":16492,"date":"2026-06-24T12:12:58","date_gmt":"2026-06-24T19:12:58","guid":{"rendered":"https:\/\/mattfife.com\/?p=16492"},"modified":"2026-06-07T12:50:16","modified_gmt":"2026-06-07T19:50:16","slug":"cuda-on-wsl2docker-on-windows-for-kokoro","status":"publish","type":"post","link":"https:\/\/mattfife.com\/?p=16492","title":{"rendered":"CUDA with WSL2+Docker on Windows for Kokoro"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In order to get <a href=\"https:\/\/github.com\/remsky\/Kokoro-FastAPI\" data-type=\"link\" data-id=\"https:\/\/github.com\/remsky\/Kokoro-FastAPI\">Kokoro text-to-speech<\/a> to work with my 5090 GPU inside a Docker container on Windows, I had to get the CUDA setup inside WSL2 using Docker images on Windows. Here were the helpful links:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Setup the WSL image with CUDA and Docker support.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Ensure you have WSL2 installed on your Windows desktop<\/li>\n\n\n\n<li>Install Docker for Windows <\/li>\n\n\n\n<li>Reboot<\/li>\n\n\n\n<li>Ensure you have the latest <a href=\"https:\/\/www.nvidia.com\/en-us\/drivers\/\" data-type=\"link\" data-id=\"https:\/\/www.nvidia.com\/en-us\/drivers\/\">NVidia GPU driver installed<\/a> on your Windows desktop<\/li>\n\n\n\n<li>Ensure you have the latest <a href=\"https:\/\/docs.nvidia.com\/cuda\/cuda-installation-guide-microsoft-windows\/\" data-type=\"link\" data-id=\"https:\/\/docs.nvidia.com\/cuda\/cuda-installation-guide-microsoft-windows\/\">NVidia CUDA sdk installed<\/a> on your Windows desktop<\/li>\n\n\n\n<li>A system reboot here is a good idea<\/li>\n\n\n\n<li>Ensure you have Microsoft Visual Studio installed for best results\n<ul class=\"wp-block-list\">\n<li>The CUDA sdk requires you have Visual Studio 2019, 2022, or 2026 installed. I have found 2022 is a solid version and seems to work well, but haven&#8217;t tried 2019 or 2026 recently. <\/li>\n\n\n\n<li>Note you need to use the &#8216;Visual Studio x64 Native tools for VS2022&#8217; command prompt if you expect to run command line compiler operations.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Now you need to install CUDA support inside WSL <a href=\"https:\/\/docs.nvidia.com\/cuda\/wsl-user-guide\/index.html\" data-type=\"link\" data-id=\"https:\/\/docs.nvidia.com\/cuda\/wsl-user-guide\/index.html\">NVidia guide<\/a>\n<ul class=\"wp-block-list\">\n<li>First follow the instructions to ensure Docker support<\/li>\n\n\n\n<li>Second follow the installation of CUDA Toolkit and CUDA Developer Tools inside WSL2 on an Ubuntu 24.04 (or later) WSL distro.\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.nvidia.com\/cuda-downloads?target_os=Linux&amp;target_arch=x86_64&amp;Distribution=WSL-Ubuntu&amp;target_version=2.0&amp;target_type=deb_local\" data-type=\"link\" data-id=\"https:\/\/developer.nvidia.com\/cuda-downloads?target_os=Linux&amp;target_arch=x86_64&amp;Distribution=WSL-Ubuntu&amp;target_version=2.0&amp;target_type=deb_local\">NVidia CUDA Toolkit 13.3 WSL2-Ubuntu download<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Optional: install nvcc so y\n<ul class=\"wp-block-list\">\n<li>sudo apt install nvidia-cuda-toolkit<\/li>\n\n\n\n<li>nvcc &#8211;version\n<ul class=\"wp-block-list\">\n<li>This prints out the version and ensures the nvcc sdk compiler is working inside your WSL image<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Ensure Docker Desktop for Windows is running on your desktop<\/li>\n\n\n\n<li><a href=\"https:\/\/docs.docker.com\/desktop\/features\/wsl\/\" data-type=\"link\" data-id=\"https:\/\/docs.docker.com\/desktop\/features\/wsl\/\">Turn on support for Docker in WSL<\/a>\n<ul class=\"wp-block-list\">\n<li><strong>Settings<\/strong> -> From the\u00a0<strong>General<\/strong>\u00a0tab, enable\u00a0<strong>Use WSL 2 based engine<\/strong>.<\/li>\n\n\n\n<li>Reboot<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Ensure your WSL image inside WSL has Docker support enabled\n<ul class=\"wp-block-list\">\n<li><strong>Settings<\/strong> -> <strong>Resources<\/strong>\u00a0-> <strong>WSL integration<\/strong>\u00a0tab -> Find and enable the slider for the WSL image under &#8216;Enable integration with additional distros&#8217;<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>I had to reboot my system at this point to get both the WSL and Windows Docker Desktop to see each other properly<\/li>\n\n\n\n<li>After reboot, ensure Windows Docker Desktop is running<\/li>\n\n\n\n<li>Set the user permissions in the WSL session to enable access (permission denied while trying to connect to the docker API at unix:\/\/\/var\/run\/docker.sock)\n<ul class=\"wp-block-list\">\n<li>sudo usermod -a -G docker &lt;username&gt;<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Now run the Kokoro docker command inside your WSL2 image:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CPU only:\n<ul class=\"wp-block-list\">\n<li>docker run &#8211;gpus all -p 8880:8880 ghcr.io\/remsky\/kokoro-fastapi-cpu:latest<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>NVidia gpu:\n<ul class=\"wp-block-list\">\n<li>docker run &#8211;gpus all -p 8880:8880 ghcr.io\/remsky\/kokoro-fastapi-gpu:latest-cu128<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Connect with the default web link:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"http:\/\/localhost:8880\/web\/\">http:\/\/localhost:8880\/web\/<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Subsequent runs:<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Ensure the Docker Desktop is running<\/li>\n\n\n\n<li>Start the WSL -d &lt;image> you set up in the first part that&#8217;s has all the CUDA stuff installed<\/li>\n\n\n\n<li>run the Kokoro docker command inside WSL<\/li>\n\n\n\n<li>Connect your web browser to the localhost address<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Raw WSL history (commands in WSL)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can&#8217;t follow this 100% directly. Note you have to stop and restart\/reboot WSL and desktop as you do the other steps above.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># NVidia CUDA setup inside WSL2 Ubuntu 24.04 image\nwget https:\/\/developer.download.nvidia.com\/compute\/cuda\/repos\/wsl-ubuntu\/x86_64\/cuda-wsl-ubuntu.pin\nsudo mv cuda-wsl-ubuntu.pin \/etc\/apt\/preferences.d\/cuda-repository-pin-600\nwget https:\/\/developer.download.nvidia.com\/compute\/cuda\/13.3.0\/local_installers\/cuda-repo-wsl-ubuntu-13-3-local_13.3.0-1_amd64.deb\nsudo dpkg -i cuda-repo-wsl-ubuntu-13-3-local_13.3.0-1_amd64.deb\nsudo cp \/var\/cuda-repo-wsl-ubuntu-13-3-local\/cuda-*-keyring.gpg \/usr\/share\/keyrings\/\nsudo apt-get update\nsudo apt-get -y install cuda-toolkit-13-3\nexit\nsudo apt install nvidia-cuda-toolkit\nnvcc --version\nexit\nsudo usermod -a -G docker matt\nexit\ndocker run --gpus all -p 8880:8880 ghcr.io\/remsky\/kokoro-fastapi-gpu:latest-cu128<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In order to get Kokoro text-to-speech to work with my 5090 GPU inside a Docker container on Windows, I had to get the CUDA setup inside WSL2 using Docker images on Windows. Here were the helpful links: Setup the WSL image with CUDA and Docker support. Now run the Kokoro docker command inside your WSL2 image: Connect with the default web link: Subsequent runs: Raw WSL history (commands in WSL) You can&#8217;t follow this 100% directly. Note you have to&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/mattfife.com\/?p=16492\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[28,9,6],"tags":[],"class_list":["post-16492","post","type-post","status-publish","format-standard","hentry","category-ai","category-cool","category-technicalproblemsolutions"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4WECr-4i0","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts\/16492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16492"}],"version-history":[{"count":3,"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts\/16492\/revisions"}],"predecessor-version":[{"id":16495,"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts\/16492\/revisions\/16495"}],"wp:attachment":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}