Help us understand the problem. What is going on with this article?

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

問題

一度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"
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away