railway service
Link a service to the current project and manage service operations.
Usage
railway service [SERVICE] [COMMAND]Subcommands
| Subcommand | Aliases | Description |
|---|---|---|
list | ls | List services in the current environment |
link | Link a service to the current project | |
delete | remove, rm | Delete a service from an environment |
status | Show deployment status for services | |
logs | View logs from a service | |
redeploy | Redeploy the latest deployment | |
restart | Restart the latest deployment | |
scale | Scale a service across regions | |
source | Connect or disconnect a service source | |
files | file | Manage files in a service filesystem |
Examples
Link a service (interactive)
railway servicePrompts you to select a service to link.
Link a specific service
railway service backendShow service status
railway service statusShow all services status
railway service status --allView service logs
railway service logsRedeploy service
railway service redeployRestart service
railway service restartScale service
railway service scale us-west=2Connect a GitHub source
railway service source connect --repo owner/repo --branch main --service webConnects the service to a GitHub repository. Use --branch to set the branch
that deploys.
Connect a Docker image source
railway service source connect --image nginx:latest --service webConnects the service to a Docker image.
Disconnect a source
railway service source disconnect --service webDisconnects the service from its current GitHub repository or Docker image source.
Browse service files
railway service files browse /appOpens an interactive TUI for browsing, downloading, uploading, editing, renaming, and deleting files in the service filesystem.
List service files
railway service files list /appDownload a file from a service
railway service files download /app/data.db ./data.dbUpload a file to a service
railway service files upload ./seed.db /app/seed.dbRename a file in a service
railway service files rename /app/data.db /app/data-old.dbDelete a file from a service
railway service files delete /app/data.dbOptions for
| Flag | Description |
|---|---|
-a, --all | Show status for all services in the environment |
--json | Output in JSON format |
Options for
| Flag | Description |
|---|---|
-d, --deployment | Show deployment logs |
-b, --build | Show build logs |
-n, --lines <N> | Number of log lines to fetch (disables streaming) |
-f, --filter <QUERY> | Filter logs using Railway's query syntax |
--latest | Show logs from latest deployment (even if failed/building) |
-S, --since <TIME> | Show logs since a specific time |
-U, --until <TIME> | Show logs until a specific time |
--json | Output logs in JSON format |
See railway logs for detailed usage and examples.
Options for
| Flag | Description |
|---|---|
-y, --yes | Skip confirmation dialog |
--json | Output in JSON format |
Options for
| Flag | Description |
|---|---|
-y, --yes | Skip confirmation dialog |
--json | Output in JSON format |
Options for
| Argument | Description |
|---|---|
REGION=REPLICAS | One or more replica assignments by region. |
| Flag | Description |
|---|---|
--json | Output in JSON format |
See railway scale for available regions and detailed usage.
Manage service sources
Use railway service source to connect a service to a GitHub repository or
Docker image, or to disconnect the service from its current source.
| Subcommand | Description |
|---|---|
source connect | Connect a service to a GitHub repository or Docker image |
source disconnect | Disconnect the service from its current source |
Options for
| Flag | Description |
|---|---|
-s, --service <SERVICE> | Service name or ID |
-e, --environment <ENVIRONMENT> | Environment to use |
-p, --project <PROJECT_ID> | Project ID to use |
--repo <REPO> | GitHub repository in owner/repo format |
--branch <BRANCH> | Branch to deploy from when connecting a GitHub repository |
--image <IMAGE> | Docker image to connect |
--json | Output in JSON format |
Pass either --repo or --image. These source options are mutually exclusive.
Options for
| Flag | Description |
|---|---|
-s, --service <SERVICE> | Service name or ID |
-e, --environment <ENVIRONMENT> | Environment to use |
-p, --project <PROJECT_ID> | Project ID to use |
--json | Output in JSON format |
Manage files
Use railway service files to manage files in a running service filesystem. The command uses the linked service by default. Pass --service, --environment, or --project to select a different target.
| Subcommand | Aliases | Description |
|---|---|---|
list | ls | List files in a directory |
browse | browser | Browse files interactively |
download | Download a file or directory | |
upload | Upload a file or directory | |
delete | rm, remove | Delete a file |
rename | mv | Rename a file |
Options for
| Flag | Description |
|---|---|
-s, --service <SERVICE> | Service name or ID |
-e, --environment <ENVIRONMENT> | Environment to use |
-p, --project <PROJECT_ID> | Project ID to use |
Options for
| Argument or flag | Description |
|---|---|
[REMOTE_PATH] | Directory path to list. Defaults to / |
--json | Output in JSON format |
Options for
| Argument or flag | Description |
|---|---|
<REMOTE_PATH> | Remote file or directory to download |
[LOCAL_PATH] | Local destination. Defaults to the current directory |
--overwrite, --override | Replace the local path if it already exists |
--concurrency <N> | Concurrent file downloads when downloading a directory. Defaults to 32 |
--json | Output in JSON format |
Options for
| Argument or flag | Description |
|---|---|
<LOCAL_PATH> | Local file or directory to upload |
<REMOTE_PATH> | Remote destination path |
--overwrite | Replace the remote path if it already exists |
--concurrency <N> | Concurrent file uploads when uploading a directory. Defaults to 32 |
--json | Output in JSON format |
Options for
| Argument or flag | Description |
|---|---|
<REMOTE_PATH> | Remote file to delete |
-y, --yes | Skip confirmation |
--json | Output in JSON format |
railway service files delete refuses to run when invoked by an AI agent and must be run by a human.
Options for
| Argument or flag | Description |
|---|---|
<OLD_REMOTE_PATH> | Existing remote path |
<NEW_REMOTE_PATH> | New remote path |
--json | Output in JSON format |
Options for
| Argument or flag | Description |
|---|---|
[REMOTE_PATH] | Directory path to open. Defaults to / |
--editor <COMMAND> | Editor command to use when editing files |
--concurrency <N> | Concurrent file downloads. Defaults to 32 |