Skip to content
Safe Inspection of a Stopped Railway Volume
takashiode0109-blip
OP

8 days ago

Hello Railway Community,

I'm investigating a startup failure involving a Railway Volume and would appreciate guidance on safely inspecting its metadata.

Issue

The Docker image builds successfully, but the application fails during startup because the mounted Volume directory is non-empty and its owner UID does not match the application's expected UID 1000.

The application intentionally refuses to start to protect existing data.

The diagnostic results confirm that:

  • The mount directory exists.
  • Directory listing succeeds.
  • The mounted directory is non-empty.
  • The mount directory's owner UID does not match 1000.
  • Database initialization has not started.

Questions

  1. Is there an officially supported method to inspect a Railway Volume when no healthy deployment is running?
  2. Can we check the mount directory's UID, GID, permissions, and entry types without reading file contents?
  3. Does Railway create any default filesystem entries or mount Volumes as root-owned?
  4. Can metadata inspection affect access timestamps or other filesystem metadata?
  5. What is the recommended approach to safely handle an existing non-empty, root-owned Volume when the application runs as a non-root user?

We are using Railway CLI 5.71.0. The Volume file commands appear to require an active deployment.

We want to preserve existing data and avoid recursive chown/chmod, deleting files, or redeploying solely for inspection.

We are requesting guidance only, not authorization for changes to any resources.

Thank you.

Solved

3 Replies

Railway
BOT

8 days ago

Volumes are mounted into your service's container as the root user, and only when the container starts (not at build or pre-deploy time). For images that run as a non-root user, the documented approach is to set RAILWAY_RUN_UID=0 as a variable on the service so the process can access the root-owned mount, which avoids any recursive chown/chmod on the existing data. See Using Volumes.

The CLI volume file commands (railway volume files list, railway volume browse) are the supported way to inspect a volume's contents, and they work against a volume attached to a running service, so there is no separate offline inspection path for a volume with no running deployment.

We have not verified whether the volume filesystem includes any entries beyond what your application wrote, whether the file listing exposes UID/GID or permission bits, or how metadata reads affect access timestamps on the volume, so we can't give you a definitive answer on those three points.


Status changed to Awaiting User Response Railway • 8 days ago


Railway

Volumes are mounted into your service's container as the `root` user, and only when the container starts (not at build or pre-deploy time). For images that run as a non-root user, the documented approach is to set `RAILWAY_RUN_UID=0` as a variable on the service so the process can access the root-owned mount, which avoids any recursive chown/chmod on the existing data. See [Using Volumes](https://docs.railway.com/volumes). The CLI volume file commands (`railway volume files list`, `railway volume browse`) are the supported way to inspect a volume's contents, and they work against a volume attached to a running service, so there is no separate offline inspection path for a volume with no running deployment. We have not verified whether the volume filesystem includes any entries beyond what your application wrote, whether the file listing exposes UID/GID or permission bits, or how metadata reads affect access timestamps on the volume, so we can't give you a definitive answer on those three points.

takashiode0109-blip
OP

8 days ago

Thank you for the response.

I understand that Railway mounts Volumes as root-owned and recommends RAILWAY_RUN_UID=0 for certain non-root container configurations.

However, our application intentionally switches from root to UID/GID 1000 after validating the mounted Volume, and it rejects unknown existing data to prevent accidental modification.

Before changing the runtime UID or redeploying, could a Railway engineer clarify:

  1. Does RAILWAY_RUN_UID=0 affect the initial container user only, or can it override an application-level UID/GID switch?
  2. Is there any supported method to inspect the ownership and metadata of an existing Volume without running the application?
  3. Is there a recommended safe approach for preserving an existing non-empty Volume while allowing an application to run as UID 1000?

We are not requesting any changes to the service or Volume at this stage.

Thank you.


Status changed to Awaiting Railway Response Railway • 8 days ago


Railway
BOT

8 days ago

Since your application already starts as root and only drops to UID/GID 1000 after its own checks, it can already read the root-owned mount. What is stopping it is your app's ownership check, not a volume permission. RAILWAY_RUN_UID=0 is documented only as the fix for images that run as a non-root user so they can reach the root-owned mount. We have not verified how it interacts with a UID switch your app makes after startup, so we can't confirm whether it would override that switch.

For inspection, the railway volume files and railway volume browse commands are the supported way to look at a volume, and they need the volume attached to a running deployment. There is no offline inspection path for a volume with no running deployment.

For keeping the existing data while running as UID 1000, the only approach we document is setting RAILWAY_RUN_UID=0 on the service. We can't give you a supported procedure beyond that which changes ownership without touching the existing data. See Using Volumes.


Status changed to Awaiting User Response Railway • 8 days ago


Railway
BOT

11 hours ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway • about 11 hours ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...