I’m searching for more than two days and unfortunately, none of the solutions worked so far.
I am running my docker under WSL 2 and I want to know where the mapped folder is.
let say
$host> docker run -ti -v /home:/home2 continuumio/anaconda3 bin/bash
$root@9fce1cb15cae> cd /home2
$root@9fce1cb15cae: /home2# ls
$root@9fce1cb15cae: /home2# touch test.txt
$root@9fce1cb15cae: /home2# ls
test.txt
now if I come out of the container, and search for test.txt I can’t find it anywhere
if I look into the wsl folder I have these two distro
and if I run the wsl -l I get this
└ $ wsl -l
Windows Subsystem for Linux Distributions:
docker-desktop (Default)
docker-desktop-data
so I’m assuming the mapping should be available inside the docker-desktop as it’s the default
if I run wsl ls /home I get empty result
the docker-desktop-data doesn’t have a home folder to begin with
if inside my windows I query for /home there isn’t such folder
if I look for the docker volume, there isn’t any volume available
and if I inspect the mounted volume, there isn’t any.
so in summary
- there is no local folder in my windows named
home - the
docker-desktophome folder is empty - the
docker-desktop-datadoesn’t have anyhomefolder - in drive
C:I don’t have any home folder
so my big question is where is the mapped folder?
interestingly if I write a windows path as the mapping, the mapping works quite well
$host> docker run -ti -v c:\users\me\repo\testing-docker:/home2 continuumio/anaconda3 bin/bash
$root@9fce1cb15cae> cd /home2
$root@9fce1cb15cae: /home2# ls
$root@9fce1cb15cae: /home2# touch test.txt
$root@9fce1cb15cae: /home2# ls
test.txt
if I go to the testing-docker I can see test.txt
so magically if I write a windows path, it works well, but as long as it’s a linux path it map it to somewhere that I don’t know and I can’t find it. it doesn’t throw any errors. if I remap the /home to another container, I can see the test.txt is there. so I’m sure the file is somewhere, but I don’t know where. so the question is where it is get mapped, where it could be that isn’t inside the wsl? I tried all the folder that mentioned in other SO answers, but none of them worked for me
I’m using Docker version 20.10.20, build 9fdeb9c