(未解決)[TravisCI]The command "docker-compose exec --env 'RAILS_ENV=test' web rails db:migrate" exited with 1.というエラー

# はじめに
本記事は、備忘録として現在解決中のエラーを記述します。

# コード

```Dockerfile:Dockerfile
FROM ruby:2.5
RUN apt-get update && apt-get install -y \
	build-essential \
	libpq-dev \
	nodejs \
	postgresql-client \
	yarn

WORKDIR /product-register
COPY Gemfile Gemfile.lock /product-register/
RUN bundle install
```

```docker-compose.yml
version: '3'

volumes:
  db-data:

services:
  web:
    build: .
    ports:
      - '3000:3000'
    volumes:
      - '.:/product-register'
    environment:
      - 'DATABASE_PASSWORD=postgres'
    tty: true
    stdin_open: true
    depends_on:
      - db
    links:
      - db

  db:
    image: postgres
    volumes:
      - 'db-data:/var/lib/postgresql/data'
    environment:
      - 'POSTGRES_USER=postgres'
      - 'POSTGRES_PASSWORD=postgres'
      - 'POSTGRES_HOST_AUTH_METHOD=trust'
```

```.travis.yml
sudo: required

services: docker

before_install:
  - docker-compose up --build -d

script:
  - docker-compose exec --env 'RAILS_ENV=test' web rails db:create
  - docker-compose exec --env 'RAILS_ENV=test' web rails db:migrate
  - docker-compose exec --env 'RAILS_ENV=test' web rails test
```

ここから、ターミナルにて以下を入力。

```
% git add .

% git commit -m 'update travis and compose'

% git push origin master  
```

TravisCIにて、確認したところ、
エラーが発生。

```
curl: (22) The requested URL returned error: 404 Not Found
Required ruby-2.5.9 is not installed - installing.
```

```
/home/travis/.rvm/scripts/fetch: line 104: log: command not found
Checking fallback: ftp://rubies.travis-ci.org/ubuntu/16.04/x86_64/ruby-2.5.9.tar.bz2?rvm=1.29.10
Checking fallback: https://www.mirrorservice.org/sites/rubies.travis-ci.org/ubuntu/16.04/x86_64/ruby-2.5.9.tar.bz2?rvm=1.29.10
No fallback URL could be found, try increasing timeout with:
```

`line 104`?

```
104  API version:      1.38 (minimum version 1.12)
```

```
Downloading https://rubies.travis-ci.org/ubuntu/16.04/x86_64/ruby-2.5.9.tar.bz2 failed.
Mounting remote ruby failed with status 2, stopping installation.
Checking requirements for ubuntu.
Requirements installation successful.
curl: (22) The requested URL returned error: 404 Not Found
Installing Ruby from source to: /home/travis/.rvm/rubies/ruby-2.5.9, this may take a while depending on your cpu(s)...
curl: (22) The requested URL returned error: 404 Not Found
```

```
Caused by:
KeyError: key not found: "DATABASE_PASSWORD"
.
.
.
The command "docker-compose exec --env 'RAILS_ENV=test' web rails db:create" exited with 1.
```

```
Caused by:
KeyError: key not found: "DATABASE_PASSWORD"
.
.
.
The command "docker-compose exec --env 'RAILS_ENV=test' web rails db:migrate" exited with 1.
```

```
Caused by:
KeyError: key not found: "DATABASE_PASSWORD"
.
.
.
The command "docker-compose exec --env 'RAILS_ENV=test' web rails test" exited with 1.
```

## 仮説
①まず、`DATABASE_PASSWORD`のキーが見つからないということは、docker-composeとpostgresがうまく繋がっていない。

②`ubuntu`のrequirementsを確認しろと怒られているので、ubuntuのバージョンが違う。

③Dockerfileに`CMD`記載がないのがダメ。

# 未解決
何とかして、明日にはエラーを解決したいと思います。
また、解決次第、編集いたします。

以下参考サイトです。
[CICDパイプラインからローカルで開発中のアプリをherokuにデプロイするの巻（Rails / postgresql / Docker / TravisCI）](https://qiita.com/igat/items/e3db24091fbd6ebc2003)
[Quickstart: Compose and Rails](https://docs.docker.com/samples/rails/)
[RVM fails to download truffleruby-head in TravisCI with 429 too many requests #4992](https://github.com/rvm/rvm/issues/4992)
[Not able to install ruby 2.2.4](https://www.digitalocean.com/community/questions/not-able-to-install-ruby-2-2-4)
[Docker cannot establish connection with postgresql in Travis CI](https://stackoverflow.com/questions/43896250/docker-cannot-establish-connection-with-postgresql-in-travis-ci)
[PostgreSQL（Docker）にRails（Docker）が接続できなくなったから調べてみた。（could not translate host name "db" to address: Name or service not known）](https://qiita.com/at-946/items/2fb75cec5355fad4050d)

引き続き頑張ります！