railway run
Execute a command locally with environment variables from your Railway service injected.
Usage
Aliases
railway local
Options
| Flag | Description |
|---|---|
-s, --service <SERVICE> | Service to pull variables from (defaults to linked service) |
-e, --environment <ENV> | Environment to pull variables from (defaults to linked environment) |
-p, --project <ID> | Project ID to use (defaults to linked project) |
--no-local | Skip local develop overrides |
-v, --verbose | Show verbose domain replacement info |
Examples
Run a Node.js app
Run a Python script
Run with specific service variables
Run database migrations
Access a repl
How it works
- Fetches environment variables from the specified Railway service
- Injects them into the command's environment
- Executes the command
This is useful for:
- Running your app locally with production/staging variables
- Running database migrations
- Accessing REPLs with the correct environment
Exit codes
The command exits with the same code as the executed command.