{"id":1123,"date":"2025-01-30T09:51:54","date_gmt":"2025-01-30T09:51:54","guid":{"rendered":"https:\/\/thomas.w-p.me.uk\/blog\/?p=1123"},"modified":"2025-01-30T09:51:54","modified_gmt":"2025-01-30T09:51:54","slug":"wsl2-docker-desktop-and-shared-drives","status":"publish","type":"post","link":"https:\/\/thomas.w-p.me.uk\/blog\/2025\/01\/wsl2-docker-desktop-and-shared-drives\/","title":{"rendered":"WSL2, Docker Desktop and Shared Drives"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A pain in the bum but I got there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I was trying to share a NFS share with an immich docker container to have a play with importing videos. The Debian could see it  but the Image could not. I am not sure if it is to do with the limit on the omv NFS IP address range or something but I knew if my Windows machine could see it then the damn WSL2 should be able to see it too, natively!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In PowerShell <code>wsl --list --verbose<\/code> lists which WSL are in use, and confusingly it gives two but the * suggested that this was the one to work with. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#FAFAFA\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"  NAME              STATE           VERSION\n* Debian            Running         2\n  docker-desktop    Running         2\" style=\"color:#90A4AE;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-lighter\" style=\"background-color: #FAFAFA\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #90A4AE\">  NAME              STATE           VERSION<\/span><\/span>\n<span class=\"line\"><span style=\"color: #39ADB5\">*<\/span><span style=\"color: #90A4AE\"> Debian            Running         <\/span><span style=\"color: #F76D47\">2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">  docker<\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\">desktop    Running         <\/span><span style=\"color: #F76D47\">2<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">I tried and tried to mount the NFS share there, but though the Debian could see it, the Docker image could not. I share the same folder using SMB so was able to get that in to WSL using:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#FAFAFA\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"wsl -d Debian\nsudo mkdir \/mnt\/p\nsudo mount -t drvfs P: \/mnt\/p\" style=\"color:#90A4AE;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-lighter\" style=\"background-color: #FAFAFA\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #90A4AE\">wsl <\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\">d Debian<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">sudo mkdir <\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">mnt<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">p<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">sudo mount <\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\">t drvfs <\/span><span style=\"color: #E2931D\">P<\/span><span style=\"color: #39ADB5\">:<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">mnt<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">p<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This makes the p: drive appear on \/mnt\/p which I could then get working in the yaml with:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#FAFAFA\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"    volumes:\n      - \/mnt\/p:\/mnt\/p_drive\" style=\"color:#90A4AE;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-lighter\" style=\"background-color: #FAFAFA\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #90A4AE\">    <\/span><span style=\"color: #E2931D\">volumes<\/span><span style=\"color: #39ADB5\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">      <\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">mnt<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #E2931D\">p<\/span><span style=\"color: #39ADB5\">:\/<\/span><span style=\"color: #90A4AE\">mnt<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">p_drive<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This worked so nicely that I couldn&#8217;t think why the NFS share worked so went back and tried it all over again. It immediately worked! <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Argh. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A pain in the bum but I got there. I was trying to share a NFS share with an immich docker container to have a play with importing videos. The Debian could see it but the Image could not. I am not sure if it is to do with the limit on the omv NFS &hellip; <a href=\"https:\/\/thomas.w-p.me.uk\/blog\/2025\/01\/wsl2-docker-desktop-and-shared-drives\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">WSL2, Docker Desktop and Shared Drives<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[110,27],"tags":[],"class_list":["post-1123","post","type-post","status-publish","format-standard","hentry","category-docker","category-geekiness"],"_links":{"self":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/comments?post=1123"}],"version-history":[{"count":1,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1123\/revisions"}],"predecessor-version":[{"id":1124,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1123\/revisions\/1124"}],"wp:attachment":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/media?parent=1123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/categories?post=1123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/tags?post=1123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}