RailwayDocs

railway run

Execute a command locally with environment variables from your Railway service injected.

Usage

Aliases

  • railway local

Options

FlagDescription
-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-localSkip local develop overrides
-v, --verboseShow 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

  1. Fetches environment variables from the specified Railway service
  2. Injects them into the command's environment
  3. 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.