title: Using Oracle pre-built Docker image as a service for GitLab CI runner
body: <p>I am currently in the process of creating an integration-tests pipeline for a few project we have running around that require the presence of an Oracle database to work. In order to do so, I have gone through the process of creating a dockerized pre-built Oracle database using the instruction mentioned in this document.</p>
  
  <p><a href="https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/samples/prebuiltdb" rel="nofollow noreferrer">https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/samples/prebuiltdb</a></p>
  
  <p>I have successfully built the image and I'm able to verify that it works indeed correctly. I have pushed the image in question to one of our custom docker repositories and I am also able to successfully fetch from the context of the runner. </p>
  
  <p>My main problem is that when the application attempts to connect to the database it fails with a connection refused error as if the database is not running (mind you I'm running the runner locally in order to test this). My question are the following:</p>
  
  <ol>
  <li><p>When using a custom image, what is the name the runner exposes it?
  For example, the documentation states that when I use <code>mysql:latest</code>
  then the exposed service name would be <code>mysql</code>. Is this the case for
  custom images as well? Should I name it with an alias?</p></li>
  <li><p>Do I need to expose ports/brigde docker networks in order to get
  this to work correctly? My reasoning behind the failure leads me to
  believe that the image that runs the application is not able to
  properly communicate with the Oracle service.</p></li>
  </ol>
  
  <p>For reference my <code>gitlab-ci.yml</code> for the job in question is the following:</p>
  
  <pre><code>integration_test:
    stage: test
    before_script:
      - echo 127.0.0.1 inttests.myapp.com &gt;&gt; /etc/hosts
    services:
      - &lt;repository&gt;/devops/fts-ora-inttests-db:latest
    script:
      - ./gradlew -x:test integration-test:test
    cache:
      key: "$CI_COMMIT_REF_NAME"
      paths:
        - build
        - .gradle
    only:
      - master
      - develop
      - merge_requests
      - tags
    except:
      - api
  </code></pre>
  
  <p>Can anyone please lend a hand in getting this to work correctly?</p>