Execute command in MongoDB yml

0

Hello I am trying to deploy a mongoDB database in a yaml file and when I start the container y want to execute the following command: sudo rm -rf /data/db/mongod.lock The .yml file is the following

    mongo-db:
image: mongo:4.0
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "7"
hostname: mongo-db
ports:
- "27017:27017"
networks:
- smartcity
command: --bind_ip_all --smallfiles
volumes:
- /dockerswarmnas/volumes/fiware_mongo-db:/data/db

  

I have tried to execute the command rm -rf /data/db/mongod.lock using the following tags in the .yml file:

1-     command: rm -rf /data/db/mongod.lock
2-     command: ["/bin/sh","-c"]
   args: ["/data/db/mongod.lock"]

Any idea on how to do it ?? Thanks Gorka