Skip to content

Commit 3238740

Browse files
Norman Kämper-LeymannPaige Hargrave
Norman Kämper-Leymann
authored and
Paige Hargrave
committed
Update rails.md
It occupied me quite a while figuring out why this sample didn't have a restart policy. And why we where supposed to always properly stop the containers wheres you normally would simply hit `Ctrl+C`. Turned out that this `pid` issue is a rails-specific issue. docker/compose#1393 (comment) And of course there's already [a Gem for fixing that](https://github.com/lorenzosinisi/shutup) but having the one-liner in the `docker-compose.yml` keeps the logic where it belongs to (and now also is treated here in the sample).
1 parent e6edbdd commit 3238740

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compose/rails.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ to link them together and expose the web app's port.
4747
services:
4848
db:
4949
image: postgres
50+
restart: always
5051
volumes:
5152
- ./tmp/db:/var/lib/postgresql/data
5253
web:
5354
build: .
54-
command: bundle exec rails s -p 3000 -b '0.0.0.0'
55+
restart: always
56+
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
5557
volumes:
5658
- .:/myapp
5759
ports:

0 commit comments

Comments
 (0)