I have a simple Rails application that I'm trying to run using Docker. When I run docker-compose up
it runs but when I load a page it tells me that my db doesn't exist. Even though when I run docker-compose run app rails db:create
it says that the db already exists.
docker-compose.yml
version: '2'
services:
db:
image: postgres
app:
build: ./rails
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- ./app:/app
ports:
- "3000:3000"
depends_on:
- db
./rails/Dockerfile
FROM ruby:2.3.3
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /app
WORKDIR /app
ADD ./Gemfile /app/Gemfile
ADD ./Gemfile.lock /app/Gemfile.lock
RUN bundle install
I'm new to Docker so I may be missing something basic.