title: Postgres error could not translate host name "postgres" to address: Name or service not known
body: <blockquote>
    <p><strong>My GitLabCI:</strong></p>
  </blockquote>
  
  <pre><code>stages:
    - test
  
  # jobs
  test_django:
    stage: test
    image: python:3.6  # this pulls the standard python 3.6 docker image
    services:
      - postgres:9.5  # this pulls a docker image with pgsql on it
    variables:
      # env vars made available to the script below
      CI_DEBUG_TRACE: "false"      # set to false to reduce the debug output from the CI jobs
      POSTGRES_DB: "project_ci_test"
      POSTGRES_USER: "postgres"
      POSTGRES_PASSWORD: ""
      DATABASE_NAME: "$POSTGRES_DB"
      DATABASE_HOST: "postgres"       # magically finds the service above
      DATABASE_USER: "postgres"
      DATABASE_PASSWORD: ""
      DJANGO_SECRET_KEY: "somerandombogusstringtokeepdjangohappyandstartingproperly"
    script:
    - apt-get update -qy
    - apt-get install -y python3-pip wkhtmltopdf xvfb  # extra packages used for pdf rendering in the tests
    - pip install -r requirements.txt
    - pep8 . --filename=*.py --ignore=E128,E265,E501 --repeat
    - python manage.py migrate
    - python manage.py test
  </code></pre>
  
  <p>But now i'm getting error while running migrations.</p>
  
  <p><strong>GitlabCi Error:</strong></p>
  
  <pre><code>     self.connection = self.get_new_connection(conn_params)
     File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
       connection = Database.connect(**conn_params)
     File "/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
       conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
   django.db.utils.OperationalError: could not translate host name "postgres" to address: Name or service not known
   ERROR: Job failed: exit code 1
  </code></pre>
  
  <p>Hello, guys could you please help me. what is wrong with my settings, it was working a few month ago but not it's not working.</p>
  
  <blockquote>
    <p><strong>Django Database Settings:</strong></p>
  </blockquote>
  
  <pre><code>DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.postgresql_psycopg2',
          'NAME': os.environ.get('DATABASE_NAME', ''),
          'USER': os.environ.get('DATABASE_USER', ''),
          'PASSWORD': os.environ.get('DATABASE_PASSWORD', ''),
          'HOST': os.environ.get('DATABASE_HOST', '127.0.0.1'),
          'PORT': '5432',
      }
  }
  </code></pre>