PostGreSQL with PostGIS

I am having difficulty getting PostGreSQL with PostGIS working in a linux container. I am following the docs and have a travis.yml that contains the following:

language: generic
sudo: true

branches:
  only:
    - dev
    - testing

matrix:
  include:
    - os: linux
      dist: trusty
      env: PYTHON_VERSION=3.6
    - os: linux
      dist: trusty
      env: PYTHON_VERSION=3.7
    

# Setup a postgresql instance w/postgis
services:
  - postgresql
addons:
  postgresql: 9.6
  apt:
    packages:
    - postgresql-9.6-postgis-2.3

before_script:
  - psql -c 'create database travis_ci_test;' -U postgres
  - psql -U postgres -c "create extension postgis"

It appears that postgresql is starting as expected:

2.87s$ travis_setup_postgresql 9.6
Starting PostgreSQL v9.6
sudo service postgresql start 9.6

I am getting the following error during the build and I am not sure how to debug further:

0.01s$ psql -c 'create database travis_ci_test;' -U postgres
psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
The command "psql -c 'create database travis_ci_test;' -U postgres" failed and exited with 2 during .

Here is a link to the build.

Any insight on how to continue to debug this would be appreciated.

Imprint