Docker Community Forums

Share and learn in the Docker community.

Postgres in WSL 2 with Docker - Operation not permitted when I share volumes enter windows folder

Postgres in WSL 2 - : Operation not permitted when I share volumes enter windows folder.

I’m using Windows WSL2 Sub system to emulate Linux on a VM.

I’m having trouble sharing the linux volume to a folder that is on windows.

WSL sets up a c directory within mnt. It is this directory that I am trying to use to create the Docker volume.

The problem does not occur when I unmount the volume on file compose.

I believe it must be something with permission in the windows folder.

Thank you

version: "3.6"
services:
  db:
    image: "postgres:10"
    container_name: "DB"
    ports:
      - "5432:5432"
    volumes:
      - "/mnt/c/Users/mar/src/data:/var/lib/postgresql/data"
    environment:
      POSTGRES_USER: "root"
      POSTGRES_PASSWORD: "root"
      POSTGRES_DB: "dev"

DB | chmod: changing permissions of ‘/var/lib/postgresql/data’: Operation not permitted DB exited with code 1

I would never use a mounted Windows folder for the Postgres data. This is a completely different file system and many file attributes are missing.