Problems while building test-mongodb image in gitlab ci/cd pipeline (DinD)

Hi,

I’m trying to build a docker image which I use during my rust integration tests.
For that I build a pipeline step in my gitlab ci/cd which builds the test image.

For that the DinD runner starts a docker compose container which mounts ./data:

volumes:
  - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
  - ./data/db:/data/db

After that the Dockerfile which will be build, should copy the ./data/db directory to /data/db in the mongodb image. This should speed up the later docker setup during the rust tests a little bit (create shards and stuff). So the mongodb docker container don’t have to parse the mongo-init.js during the rust tests.

Here is the whole docker compose file which will be started. After some seconds it will be shutted down to create the data/db content:

services:
  mongodb-test-image-builder:
    image: mongo:latest
    restart: unless-stopped
    command: mongod --replSet rs0 --bind_ip 0.0.0.0
    user: root
    volumes:
      - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
      - ./data/db:/data/db

Before I run docker compose up -d I run:

rm -fr ./data/

mkdir ./data

chmod -R 777 ./data/

chown -R 999:999 ./data/

But I get always the following server log while startup and no file will be created:

I’m very confused. Even if I enter the ci/cd runner docker image myself and then excecute everthing manually it does not work.

T