LoginSignup
0
0

More than 3 years have passed since last update.

docker-composeでrailsを立ち上げた時にA server is already running.と言われる問題

Posted at

問題

一度docker-composeで立ち上げて消すとtmp/pids/server.ipdが残るっぽいので、
こいつを消し去りたい。

$ docker-compose up
web_api_1           | A server is already running. Check /app/tmp/pids/server.pid.
web_api_1           | => Booting WEBrick
web_api_1           | => Rails 5.0.6 application starting in development on http://0.0.0.0:3000
web_api_1           | => Run `rails server -h` for more startup options
web_api_1           | Exiting

解決

docker-compose.ymlの設定でserver.ipdを消し去るコマンドを流すようにする。

version: '3'
services:
  web_api:
    build: .
    # もともとの設定
    # command: bundle exec rails s -p 3000 -b '0.0.0.0'
    command: /bin/sh -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
    volumes:
      - .:/app
    ports:
      - "3000:3000"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0