title: Docker 1 exited with code 0 when using knex migrate
body: <p>I'm getting this error </p>
  
  <blockquote>
    <p>app_1<br>
    Using environment: development app_1    Ran 1 seed</p>
    
    <p>files express_app_1 exited with code 0</p>
  </blockquote>
  
  <p>when executing this command on docker-compose.yml.</p>
  
  <pre><code>command: bash -c "npm run migrate &amp;&amp; npm run seed"
  </code></pre>
  
  <p>What would be an alternative way to execute this command so i can avoid the error.</p>
  
  <p><strong>docker-compose.yml</strong> </p>
  
  <pre><code># docker-compose.yml
  version: "3"
  services:
    app:
      build: .
      depends_on:
        - database
      ports:
        - 3000:3000
      environment:
        - HOST=database
        # name of the container for ex .*****
        # docker exec -it ***** psql -U postgres -c "create database es6knex"
        # ^ this creates the es6knex database
        - DBNAME=es6knex
      env_file:
        - .env
      command: bash -c "npm run migrate &amp;&amp; npm run seed"
  
    database:
      image: postgres:9.6.8-alpine
      volumes:
        - db-data:/var/lib/postgresql/data
      environment:
        POSTGRES_PASSWORD: ${DBPASS:-password}
        POSTGRES_USER: ${DBUSER:-knexuser}
        POSTGRES_DB: ${DBNAME:-es6knex}
      ports:
        - 8002:5432
      env_file:
        - .env
  volumes:
    db-data:
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
    "name": "elies6express",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "test": "./node_modules/.bin/mocha --watch --require @babel/register",
      "start": "nodemon --exec babel-node main.js",
      "migrate": "babel-node node_modules/.bin/knex migrate:latest",
      "seed": "babel-node node_modules/.bin/knex seed:run"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
      "body-parser": "^1.19.0",
      "bookshelf": "^0.14.2",
      "chai-http": "^4.3.0",
      "cookie-parser": "^1.4.4",
      "cors": "^2.8.5",
      "dotenv": "^8.0.0",
      "express": "^4.17.0",
      "knex": "^0.16.5",
      "morgan": "^1.9.1",
      "path": "^0.12.7",
      "pg": "^7.11.0"
    },
    "devDependencies": {
      "@babel/cli": "^7.4.4",
      "@babel/core": "^7.4.5",
      "@babel/node": "^7.4.5",
      "@babel/preset-env": "^7.4.5",
      "@babel/register": "^7.4.4",
      "chai": "^4.2.0",
      "mocha": "^6.1.4",
      "nodemon": "^1.19.0",
      "reify": "^0.19.1",
      "request": "^2.88.0"
    }
  }
  </code></pre>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM node:8
  
  # Create app directory
  WORKDIR /usr/src/app
  
  # Install app dependencies
  # A wildcard is used to ensure both package.json AND package-lock.json are copied
  # where available (npm@5+)
  COPY package*.json ./
  
  RUN npm install
  # If you are building your code for production
  # RUN npm ci --only=production
  
  # Bundle app source
  COPY . .
  
  EXPOSE 3000
  CMD [ "npm", "start" ]
  </code></pre>