I have been struggling to configure the execution of scripts via /docker-entrypoint-initdb.d in a Mongo container in Docker.
I have tried to follow the documentation carefully, but without success.
project structure
docker-compose.yml
version: '3.3' services: mongodb: image: mongo:latest container_name: mongo_db environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: rootpass MONGO_INITDB_DATABASE: database volumes: - mongodbdata:/data/db - ./init.d/:/docker-entrypoint-initdb.d/ restart: always volumes: mongodbdata: driver: local init-mongo.sh
#!/bin/bash echo 'hello script' In the logs the command echo 'hello script' is not executed.
What should I do? Is there something I'm missing?
