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

1.2k views Asked by At

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

1

There are 1 answers

0
marcelo.delta On BEST ANSWER

I created an internal volume in Docker.

This way I can share the files from the location to the volume.