A server is already running. Check …/tmp/pids/server.pid. Exiting - rails

server.pid only contains the process ID of the running server.

If you do:

more /your_project_path/tmp/pids/server.pid

you will get a number (say 6745) which you can use to stop the previous server with the command kill:

kill -9 6745

and then you can remove the file with the rm command

rm /your_project_path/tmp/pids/server.pid

You can delete the server.pid file.

rm /your_project_path/tmp/pids/server.pid

Else:

try in OSX:

sudo lsof -iTCP -sTCP:LISTEN -P | grep :3000

or in linux:

ps -aef | grep rails

or

lsof -wni tcp:3000

kill the process using

kill -9 PID (eg,2786)

Short and Crisp single line command, that will take care of it.

kill -9 $(lsof -i tcp:3000 -t)

If you are using docker-compose, and in docker-compose.yml have: volumes: - .:/myapp That means you local workspace is mapped to the container's /myapp folder.

Anything in /myapp will not be deleted for the volumes define.

You can delete ./tmp/pids/server.pid in you local machine. Then the container's /myapp will not have this file.