title: gitlab pipeline with embedded mongodb
body: <p>I'm trying to build a pipeline for a gradle java app which is using an embedded mongo instance. I have built a container to which has java and mongo. However, I keep getting the following error for all my test that require the embedded mongo instance.</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'embeddedMongoServer' 
  defined in class path resource [org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.class]: 
  Invocation of init method failed; nested exception is java.io.IOException: 
  Cannot run program "/tmp/extract-f816c11c-614b-46d7-ad29-68923ca9d624extractmongod": error=2, No such file or directory
  </code></pre>
  
  <p>My <code>gitlab-ci.yml</code> looks like this: </p>
  
  <pre><code>image: java:latest
  services:
    - docker:dind
  
  variables:
    GRADLE_OPTS: "-Dorg.gradle.daemon=false"
    DOCKER_DRIVER: overlay
    SPRING_PROFILES_ACTIVE: gitlab-ci
  
  stages:
    - build
    - test
  
  build:
    stage: build
    script: ./gradlew --build-cache assemble
    cache:
      key: "$CI_COMMIT_REF_NAME"
      policy: push
      paths:
        - build
        - .gradle
  
  test:
    stage: test
    image: registry.gitlab.com/path/to/explorer-ci:1.0.0
    script: ./gradlew check --debug
    cache:
      key: "$CI_COMMIT_REF_NAME"
      policy: pull
      paths:
        - build
        - .gradle
  </code></pre>
  
  <p>The build job works fine, the test job fails. My explorer-ci container is built using the following Dockerfile</p>
  
  <pre><code>FROM openjdk:8-jdk-alpine
  
  RUN apk update &amp;&amp; \
      apk add --no-cache \
          mongodb \
          bash
  
  VOLUME /data/db
  VOLUME log
  
  RUN ["mongod", "--smallfiles", "--fork", "--logpath", "log/mongodb.log"]
  </code></pre>
  
  <p>I've spent a week with a bunch of different configs but can't seem to hack it. Just to note, builds/tests run fine on my local machine. Any ideas of what I'm doing wrong?</p>