Docker ownership of '/var/lib/postgresql/data'

Viewed 447

Docker-compose is not running and I don't know why. There's this question of

chown: changing ownership of '/var/lib/postgresql/data': Operation not permitted

At a suggestion of a member on the docker community slack channel I installed the homebrew for Docker, but that hasn't managed to solve the problem. There was another stackoverflow post that suggested cc'ing inside the container and changing the permissions, but that doesn't make sense to me - the /var/lib/postgresql/data is created on startup.

Here is the docker-compose file -

version: "3.9"

services:
  db:
    restart: always
    image: postgres
    volumes:
      - ./docker-entrypoint-initdb.d/init.sql:/docker-entrypoint-initdb.d/init.sql
      - ./data/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_NAME=dev-postgres
      - POSTGRES_USER=pixel
      - POSTGRES_DATABASE=lightchan
      - POSTGRES_PASSWORD=stardust 
  web:
    build: .
    restart: always
    volumes:
      - .:/code
    command: sh -c "./waitfor.sh db:5432 -- python3 manage.py runserver"
    ports:
      - "8001:8001"
    environment:
      - POSTGRES_NAME=dev-postgres
      - POSTGRES_USER=pixel
      - POSTGRES_DATABASE=lightchan
      - POSTGRES_PASSWORD=stardust
      - POSTGRES_HOST=db  
0 Answers
Related