title: How to target container in GitHub actions?
body: <p>I am trying to use GitHub Actions to fire up a Postgres container for my tests. I have a script called <code>build.sh</code> that gets called when <code>npm run build</code> is called via GitHub actions. This script calls upon <code>restore-schema.sh</code> (shown below).</p>
  <p>The issue here is when <code>restore-schema.sh</code> gets ran, I keep getting <code>Error: no such container: postgres</code>. GitHub actions is naming the container some arbitrary string. Is there not a way I can run docker exec on an image or somehow name the postgres container that GitHub actions is creating? I've looked through both documentations to no avail.</p>
  <p>How should I go about this? I noticed that in the <em>Docker run ps</em> screenshot, it shows command <code>docker-entrypoint.sh</code>. Should I use this instead? Do I specify the Dockerfile inside <code>.github/workflows/</code>?</p>
  <p>I tried to include as much relevant information as possible - comment if you need any other information please.</p>
  <p><strong>Screenshots from GitHub Actions</strong></p>
  <ul>
  <li><a href="https://i.imgur.com/YXl3VBV.jpg" rel="nofollow noreferrer">Initialize containers</a></li>
  <li><a href="https://i.imgur.com/2ussqSr.png" rel="nofollow noreferrer">Docker run ps</a> <strong>&lt;- docker ps showing name postgres</strong></li>
  <li><a href="https://i.imgur.com/ZQYzfuW.jpg" rel="nofollow noreferrer">Run npm run build --if-present</a> <strong>&lt;- WHERE THE ISSUE IS OCCURING</strong></li>
  </ul>
  <p><em>build.sh</em></p>
  <pre><code>#!/bin/sh
  
  # Import core db schema
  ./.deploy/postgres/restore-schema.sh
  </code></pre>
  <p><em>.deploy/postgres/restore-schema.sh</em></p>
  <pre><code>#!/bin/sh
  
  
  docker exec -it postgres psql \
  --username postgres \
  --password dev \
  coredb &lt; .deploy/postgres/db-schema.sql
  </code></pre>
  <p><em>.github/workflows/test-api-gateway.yml</em></p>
  <pre><code>name: API Gateway CI
  
  on:
    push:
      branches: [ master ]
    pull_request:
      branches: [ master, develop ]
  
  jobs:
    build:
      runs-on: ubuntu-latest
      services: # Serivce containers to run with `container-job`
        # Label used to access the service container
        postgres:
          # Docker Hub image
          image: postgres
          # Provide the password for postgres
          env:
            POSTGRES_USER: postgres
            POSTGRES_DB: coredb
            POSTGRES_PASSWORD: dev
          # Set health checks to wait until postgres has started
          options: &gt;-
            --health-cmd pg_isready
            --health-interval 10s
            --health-timeout 5s
            --health-retries 5 
          ports:
            - 5432:5432
  
      strategy:
        matrix:
          node-version: [14.x]
  
      steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: docker ps
      - run: chmod +x build.sh .deploy/postgres/restore-schema.sh
      - run: npm ci
      - run: npm run build --if-present
      - run: npm test
  </code></pre>