Mounted Windows Network Drive using WSL is not visible in Docker for Desktop CLI terminal

Hello there,

I am using WSL2 and Docker Desktop for Windows.

I managed to “successfully” mount my network drive using WSL bash terminal like this:

cd /etc
sudo chmod -R 777 fstab
echo "////www-testdrive//data-users//mydata /media/data-users drvfs dom=teralab,user=johnny,vers=2.0,nobrl,cache=none,echo_interval=1,actimeo=0,rsize=1024 0 0" >> fstab

Those lines above allowed me to call sudo mount -a after I start my WSL which mounts my network drive.

When I execute cd /media/data-users and ls, I can see all my files from the mounted network drive.

So far, so good.

The problem is, if I run my Docker container in WSL terminal docker-compose up, everything seems OK, but if I go to the Docker Desktop for Windows and open container’s CLI terminal I cannot see any of my files from the network drive - the directory /media is completely empty after executing cd /media & ls.

I think, I might have some problem with mapping in my docker-compose.yml, because I can only see mounted files in WSL terminal, but not in container’s CLI terminal in the Docker Desktop app.

Here’s my docker-compose.yml:

version: '3.8'

services:
  apache:
    image: 'docker-registry.teralab.com/robot:aio-20210824'
    volumes:
      - /media/data-users/:/data-users:rw
      - /mnt/c/dev/common:/common
      - /mnt/c/dev/robot:/web
      - ./logs:/var/log/apache2
      - ./logs:/var/log/php
      - ./apache2:/usr/local/apache2/conf:ro
      - ./odbcinst.ini:/etc/odbcinst.ini:ro
      - ./php:/usr/local/etc
      - ./msmtp/msmtprc:/etc/msmtprc:ro
    environment:
      - http_proxy=http://proxy.teralab.com:1234
      - https_proxy=http://proxy.teralab.com:1234
      - no_proxy=composer.teralab.com,debian.teralab.com
      - APACHE_RUN_USER=www-data
      - APACHE_RUN_GROUP=www-data
      - APACHE_PID_FILE=/run/apache2.pid
      - IS_DOCKER_CONTAINER=true
    networks:
      - web
    labels: &apache_labels_default
      - "traefik.enable=true"
      - "traefik.http.routers.robot-johnny-teralab-com.rule=Host(`robot.johnny.teralab.com`)"
      - "traefik.http.routers.robot-johnny-teralab-com.tls=true"
      - "traefik.http.services.robot-johnny-teralab-com.loadbalancer.server.port=8080"
    deploy:
      replicas: 1
      placement:
        constraints:
          - node.role == manager
      labels: *apache_labels_default
    user: "1000:www-data"

networks:
  web:
    external: true

Pls help.

Hey did you get this figured out? I’m having the same issue and have been unable to mount Windows-host network drives as volumes in my docker containers