Mvn test - embedded mongodb failes to start permissions issue

Hi, Our java tests uses embedded mongo db which cannot start due to permissions error: java.io.IOException: Cannot run program “/tmp/extract-ad857d34-ab3d-4f7e-b8da-e60c26a38f9dmongod”: error=13, Permission denied

I have tried to use ‘sudo mvn’ . But then I get error the build cannot download artifacts due to ‘Not authorized’ error

the yml file:
image: docker:latest

services:

  • docker:dind

variables:
DOCKER_DRIVER: overlay

stages:

  • build

maven-build:
image: maven:3-jdk-7
stage: build
script: “mvn compile test”

Any help will be appreciated