WSL,Docker:无法看到已安装的卷内容

时间:2018-04-23 13:15:05

标签: docker windows-subsystem-for-linux

在关注this tutorial之后,应该能够看到卷的内容。例如,这是预期的结果:

    $ sudo ls -la /var/lib/docker/volumes

    total 744
    drwx------ 57 root root 131072 Sep  2 20:52 .
    drwx--x--x 12 root root   4096 Sep  2 09:06 ..
    drwxr-xr-x  3 root root   4096 Sep  2 20:52 crv

使用Windows上的Docker(和installed in WSL),我得到:

  

ls:无法访问'/ var / lib / docker / volumes / crv / _data':没有这样的文件或   目录

george@gwb-10:/mnt/g/Documents/workspace/docker$ docker volume create crv
crv
george@gwb-10:/mnt/g/Documents/workspace/docker$ docker inspect crv
[
    {
        "CreatedAt": "2018-04-23T13:12:08Z",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/crv/_data",
        "Name": "crv",
        "Options": {},
        "Scope": "local"
    }
]
george@gwb-10:/mnt/g/Documents/workspace/docker$ sudo ls -la /var/lib/docker/volumes
ls: cannot access '/var/lib/docker/volumes': No such file or directory

1 个答案:

答案 0 :(得分:0)

某种结果。我不理解语法,但很明显存在预期结果:

的PowerShell:

G:\Documents\workspace\docker> docker run --rm -v /var/lib/docker/volumes:/data alpine ls /data
crv
metadata.db
G:\Documents\workspace\docker> docker run --rm -v /var/lib/docker/volumes/crv:/data alpine ls /data
_data

WSL:

george@gwb-10:/mnt/g/Documents/workspace/docker$ docker.exe run --rm -v /var/lib/docker/volumes:/data alpine ls /data
crv
metadata.db
george@gwb-10:/mnt/g/Documents/workspace/docker$ docker.exe run --rm -v /var/lib/docker/volumes/crv:/data alpine ls /data
_data