Search code examples
dockerdocker-composedocker-desktopwsl-2plex

How to mount large volume in Docker Desktop (WSL2)?


I am new to Docker and tried to set up Plex Media Server (https://docs.linuxserver.io/images/docker-plex) on Windows, using Docker Desktop and WSL2. I used docker-compose using the yml file shown below. I need to mount my media folders (on Windows drive F:) into the docker container, for obvious resasons.

I read that it is recommended to load the data into the WSL (https://docs.docker.com/docker-for-windows/wsl/#best-practices and https://stackoverflow.com/a/64238886/6149322), however since the media libray is very large (several hundret GB) it needs to be kept on a different hard drive. Hence, I think I cannot just move it to the WSL file system.

When I try to run docker-compose -f "docker-compose.yml" up -d --build, I get the following error message and a popup from Docker Desktop: ("Zugriff verweigert" is german for "access denied")

Creating plex ... error

ERROR: for plex  Cannot create container for service plex: Zugriff verweigert

ERROR: for plex  Cannot create container for service plex: Zugriff verweigert
ERROR: Encountered errors while bringing up the project.

enter image description here

Do you have any ideas or hints for me? Thank you very much!


docker-compose.yml file:

version: "2.1"
services:
  plex:
    image: ghcr.io/linuxserver/plex
    container_name: plex
    network_mode: bridge
    environment:
      - PUID=1000
      - PGID=1000
      - VERSION=docker
    volumes:
      - /f/Plex:/config
      - /f/Serien:/tv
      - /f/Filme:/movies
    ports:
      - 32400:32400
    restart: unless-stopped

Solution

  • I think I have resolved this issue as follows. I am not entirely sure which step was the key...

    • Set "Ubuntu" as my default wsl system (instead of docker-desktop-data) using the command wsl --set-default Ubuntu in PowerShell
    • Copied my docker-compose.yml into the WSL file system. You can mount the WSL system in your Windows Explorer by typing \\WLS$ in the path file of Windows Explorer.
    • Opened the Ubuntu shell and run the docker-compose command from there. Now it works fine with the following volume definition
    volumes:
          - /mnt/f/Plex:/config
          - /mnt/f/Serien:/tv
          - /mnt/f/Filme:/movies
    

    Hope this helps anyone with a similar problem :)