docker – Execute SQL script when starting PostgreSQL container

I am starting a container with the following docker-compose:

version: '3.3'

services:
  postgresql:
    container_name: postgreSQL
    restart: always
    image: centos / postgresql-96-centos7: latest
    volumes:
      - ./data:/var/lib/postgresql/data
      - ./init.sql:/docker-entrypoint-initdb.d/init.sql
    environment:
      POSTGRESQL_USER: user
      POSTGRESQL_PASSWORD: pass
      POSTGRESQL_DATABASE: db
      POSTGRESQL_ADMIN_PASSWORD: root
    ports:
      - "5432: 5432"

To start it execute docker-compose up, but do not create the table I indicated in init.sql:

CREATE TABLE test (id SERIAL Primary Key);

init.sql is at the same level as docker-compose.yml, what could be the problem?