[Docker + Rails] How to deal with Rails server startup failure

Introduction

The following error log is output when you try to start the server.

A server is already running. Check /app/tmp/pids/server.pid.

Cause

The cause is that the server.pid file created when the Rails server was started last time remains.

Solutions

When I looked it up on various sites, there should be three.

① Restart the terminal

Reference: A server is already running Remedy [Rails]

② Delete the server.pid file

Delete the /app/tmp/pids/server.pid file each time an error occurs. It's a surefire way, but it's a hassle ...

③ Automatically delete the server.pid file when the server starts (recommended)

I think this is the easiest way. Set the ** command ** part of the docker-compose.yml file as follows.

docker-compose.yml


command: bash -c "rm -f tmp/pids/server.pid ; bundle exec rails s -p 3000 -b 0.0.0.0"

Recommended Posts

[Docker + Rails] How to deal with Rails server startup failure
[Rails] How to use rails console with docker
How to build Rails 6 environment with Docker
[Rails] How to build an environment with Docker
How to terminate rails server
[Docker environment] How to deal with ActiveSupport :: MessageEncryptor :: InvalidMessage
[Rails] How to deal with URL changes after render
Connect to Rails server with iPhone
How to get along with Rails
How to start Camunda with Docker
How to build Rails, Postgres, ElasticSearch development environment with Docker
[Rails / RSpec] How to deal with element has zero size error
How to share files with Docker Toolbox
[Android] How to deal with dark themes
Deploy to heroku with Docker (Rails 6, MySQL)
How to install Pry after building Rails development environment with Docker
How to build Rails + Vue + MySQL environment with Docker [2020/09 latest version]
How to deal with Precompiling assets failed.
How to run Blazor (C #) with Docker
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
How to give your image to someone with docker
[Rails] How to easily implement numbers with pull-down
How to build API with GraphQL and Rails
How to use nginx-ingress-controller with Docker for Mac
Easy to display hello world with Rails + Docker
How to write Rails
Rails deploy with Docker
How to install Docker
[Rails] How to search by multiple values ​​with LIKE
Diet program with preprocessor (how to deal with i-appli size)
How to deal with fatal: remote origin already exists.
How to build docker environment with Gradle for intelliJ
How to delete a new_record object built with Rails
How to deal with No template for interactive request
How to manually generate a JWT with Rails Knock
[How to insert a video in haml with Rails]
How to delete untagged images in bulk with Docker
How to make Laravel faster with Docker for Mac
How to query Array in jsonb with Rails + postgres
Common problems with WSL and how to deal with them
How to get started with creating a Rails app
[Rails] [Docker] Copy and paste is OK! How to build a Rails development environment with Docker
[Docker] How to update using a container on Heroku and how to deal with Migrate Error
How to deal with `Cannot connect to the Docker daemon at unix: /// var/run/docker.sock. Is the docker daemon running?`
How to deal with errors in Rails s could not find a JavaScript runtime.
[Rails] How to use enum
How to read rails routes
How to set Docker nginx
How to use rails join
How to number (number) with html.erb
Run Rails whenever with docker
How to update with activerecord-import
[Docker] Rails 5.2 environment construction with docker
How to write Rails validation
How to write Rails seed
[Rails] How to disable turbolinks
[Rails] How to use authenticate_user!
[Rails] How to implement scraping
[Rails] How to make seed
How to write Rails routing