# Rails: A server is already running (pid: 12345, file: /app/tmp/pids/server.pid). Exiting

**Code:** `A server is already running. Check /tmp/pids/server.pid` · **Category:** Ruby / Rails · **Seen on:** Ruby, Docker, Linux

Rails thinks another server is running because a stale `server.pid` exists (often after a crash or in Docker).

## Meaning

If no server runs, delete `tmp/pids/server.pid` and start again. In Docker add `rm -f tmp/pids/server.pid` to the entrypoint. If a server does run, find it (`lsof -i :3000`) and stop it, or use another port (`-p 3001`).

## Common causes

- Stale pid file after crash/forced stop
- Container restart reusing a volume with the pid file
- Another Rails server really running
- Port 3000 in use
- Mounted `tmp` shared between containers

## Quick fix

1. `rm -f tmp/pids/server.pid`
2. Docker entrypoint: `rm -f /app/tmp/pids/server.pid`
3. Check `lsof -i :3000` for a real process

## Detailed fix by platform

### Linux

1. `lsof -i :3000; rm -f tmp/pids/server.pid; bin/rails s`

## How to diagnose

1. **Process** — Really running?
2. **Pid file** — Stale?
3. **Docker** — Entrypoint cleans?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ruby/rails-server-already-running-pid-file)
