I have the following docker compose file:
version: "3"
services:
  postgres:
    image: postgres:11.2-alpine
    environment:
      POSTGRES_PASSWORD: root
      POSTGRES_USER: root
    ports:
      - "5432:5432"
    volumes:
      - ./init-db/init-db.sql:/docker-entrypoint-initdb.d/init.sql
This is the init-db.sql:
CREATE TABLE users (
    email VARCHAR(355) UNIQUE NOT NULL,
    password VARCHAR(256) NOT NULL
);
CREATE TABLE products (
    id SERIAL PRIMARY KEY,
    title VARCHAR(100) NOT NULL,
    price NUMERIC(6, 2) NOT NULL,
    category INT NOT NULL
);
INSERT INTO users VALUES ('test@test.com', 'Test*123');
INSERT INTO products (title, price, category) VALUES ('Truco', 9.90, 13);
When I run docker-compose up, I'm getting this error:
server started
/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init.sql
/docker-entrypoint-initdb.d/init.sql: Permission denied
I already tried to:
chmod 777on the sql filechmod -xon the sql file- Run docker and docker-compose using 
sudo 
Any idea?