From 4c36f67964b6271a1f174998329daa5009516e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20K=C3=A4mper-Leymann?= Date: Fri, 2 Mar 2018 10:26:02 +0100 Subject: [PATCH] Update rails.md Avoid running `docker-compose run web rake db:create` every time you restart/rebuild the app. --- compose/rails.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/compose/rails.md b/compose/rails.md index 5828be47ab..3bf59fa9d7 100644 --- a/compose/rails.md +++ b/compose/rails.md @@ -50,6 +50,8 @@ to link them together and expose the web app's port. services: db: image: postgres + volumes: + - ./tmp/db:/var/lib/postgresql/data web: build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' @@ -231,10 +233,7 @@ application with `docker-compose up`. ### Restart the application -To restart the application: - -1. Run `docker-compose up` in the project directory. -2. Run this command in another terminal to restart the database: `docker-compose run web rake db:create` +To restart the application run `docker-compose up` in the project directory. ### Rebuild the application @@ -254,8 +253,7 @@ the changes: ports: - "3001:3000" ``` -Now, rebuild and restart the app with `docker-compose up --build`, then restart -the database: `docker-compose run web rake db:create`. +Now, rebuild and restart the app with `docker-compose up --build`. Inside the container, your app is running on the same port as before `3000`, but the Rails Welcome is now available on `http://localhost:3001` on your local