TransWikia.com

Docker Desktop WSL2 volume mapping not working

Super User Asked by Campingenieur on January 24, 2021

I’m running Docker Desktop with WSL2 backend.

I’m trying to run a docker-compose.yml which looks like the following:

version: '3.8'
services:
  foo-service:
    volumes:
      - /home/foo:/var/lib/foo

A docker inspect on the container gives:

"HostConfig": {
            "Binds": [
                "/home/foo:/var/lib/foo:rw"
            ]
[..]
"Mounts": [                                        
    {                                              
        "Type": "bind",                            
        "Source": "/home/foo",
        "Destination": "/var/lib/foo",           
        "Mode": "rw",                              
        "RW": true,                                
        "Propagation": "rprivate"                  
    }                                              
],   

So when I do a docker-compose up I expect that the volume mapping could be found under \wsl$docker-desktophomefoo but the home directory is empty whereas the volumes under \wsl$docker-desktop-datamntwsldocker-desktop-datadatadockervolumes are created.

When I connect Docker Desktop with my WSL2 Ubuntu distribution and run the compose file from inside the mapping is created successfully.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP