8 hours ago
Volume mount still not working after recreating volume.
Tried:
- Mount path: /data
- Start command: mkdir -p /data && sleep 10 && streamlit run...
- Deleted and recreated volume
- Multiple redeploys
Deploy logs consistently show:
Checking /data: exists=False, writable=False
The mkdir -p /data runs successfully (no errors) but
Railway mounts the volume AFTER the app starts checking.
Is there a known issue with volume mounting on Hobby plan
with Nixpacks builder?
19 Replies
Status changed to Open Railway • about 8 hours ago
8 hours ago
I would highly recommend migrating to Dockerfile or Railpack as Nixpacks is deprecated.
0x5b62656e5d
I would highly recommend migrating to Dockerfile or Railpack as Nixpacks is deprecated.
8 hours ago
Thank you! I'm using Nixpacks because Railway auto-detected
it for my Python/Streamlit app.
Could you guide me on how to migrate to Dockerfile or
Railpack for a Streamlit app? Will this fix the volume
mounting issue?
7 hours ago
Hi, I think this reply might be for a different thread.
My issue is about Railway Volume not mounting for a
Python/Streamlit app. 
liluboutik-collab
Hi, I think this reply might be for a different thread.My issue is about Railway Volume not mounting for aPython/Streamlit app.
7 hours ago
Took care of it.
liluboutik-collab
Thank you! I'm using Nixpacks because Railway auto-detectedit for my Python/Streamlit app.Could you guide me on how to migrate to Dockerfile orRailpack for a Streamlit app? Will this fix the volumemounting issue?
7 hours ago
I'm not 100% sure it'll fix the mounting issue, but it might. (As Nixpacks is deprecated).
You can probably get an AI agent (like ChatGPT) to draft up a Dockerfile or a Railpack configuration for you based on your application.
You can refer to Railpack docs at https://railpack.com/getting-started if needed.
5 hours ago
Even with Dockerfile detected and ENTRYPOINT set,
Railway seems to be injecting STREAMLIT_SERVER_PORT=$PORT
before our entrypoint runs. The entrypoint never executes.
Custom start command also doesn't help.
Is Railway auto-generating a start command for Streamlit
apps that overrides the Dockerfile ENTRYPOINT?
5 hours ago
I'd try using CMD. Also, remove any custom start commands if you have one set.
0x5b62656e5d
I'd try using CMD. Also, remove any custom start commands if you have one set.
4 hours ago
Thank you! Removed the custom start command and
updated Dockerfile to use CMD instead of ENTRYPOINT.
Redeploying now — will update with results!
Status changed to Awaiting User Response Railway • about 4 hours ago
0x5b62656e5d
I'd try using CMD. Also, remove any custom start commands if you have one set.
4 hours ago
Still getting same error after using CMD and removing
custom start command.
Even with ENV STREAMLIT_SERVER_PORT=8080 in Dockerfile,
Railway seems to be overriding it with $PORT (literal string).
Error: Invalid value for '--server.port'
(env var: 'STREAMLIT_SERVER_PORT'): '$PORT' is not a valid integer
Is Railway auto-injecting STREAMLIT_SERVER_PORT=$PORT
for Streamlit apps? How can we prevent this?
Status changed to Awaiting Railway Response Railway • about 4 hours ago
0x5b62656e5d
What's your CMD command?
4 hours ago
CMD ["streamlit", "run", "layout.py"]
With ENV in Dockerfile:
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_SERVER_PORT=8080
Full Dockerfile:
FROM python:3.11-slim
RUN mkdir -p /data
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_SERVER_PORT=8080
CMD ["streamlit", "run", "layout.py"]
4 hours ago
Try CMD ["sh", "-c", "streamlit run layout.py --server.address=0.0.0.0 --server.port=${PORT:-8080}"].
0x5b62656e5d
Try CMD ["sh", "-c", "streamlit run layout.py --server.address=0.0.0.0 --server.port=${PORT:-8080}"].
3 hours ago
Still same error with your suggested CMD:
CMD ["sh", "-c", "streamlit run layout.py
--server.address=0.0.0.0 --server.port=${PORT:-8080}"]
Error: Invalid value for '--server.port'
(env var: 'STREAMLIT_SERVER_PORT'): '$PORT'
is not a valid integer
It seems STREAMLIT_SERVER_PORT=$PORT is being injected
BEFORE our CMD runs and Streamlit reads the env var
before our CLI args can override it.
Is Railway auto-setting STREAMLIT_SERVER_PORT for
Streamlit apps? How can we clear it?
liluboutik-collab
Still same error with your suggested CMD:CMD ["sh", "-c", "streamlit run layout.py--server.address=0.0.0.0 --server.port=${PORT:-8080}"]Error: Invalid value for '--server.port'(env var: 'STREAMLIT_SERVER_PORT'): '$PORT'is not a valid integerIt seems STREAMLIT_SERVER_PORT=$PORT is being injectedBEFORE our CMD runs and Streamlit reads the env varbefore our CLI args can override it.Is Railway auto-setting STREAMLIT_SERVER_PORT forStreamlit apps? How can we clear it?
2 hours ago
1. Delete the Lingering Variable in Railway
When you initially deployed using Nixpacks, Railway likely auto-detected Streamlit and injected STREAMLIT_SERVER_PORT=$PORT into your service's environment. Switching to a Dockerfile builder doesn't delete old variables.
Go to your Railway Dashboard.
Click on your Streamlit service.
Go to the Variables tab.
Find
STREAMLIT_SERVER_PORT(and any other auto-generatedSTREAMLIT_variables you didn't manually set).Delete them.
2. Update Your Dockerfile
Railway dynamically assigns a port to your container via the $PORT environment variable. Now that the bad variable is gone, you can tell Streamlit to use Railway's $PORT natively in the CMD.
Here is the clean Dockerfile to use:
Dockerfile
FROM python:3.11-slim
# Create the data directory (Railway will mount the volume over this)
RUN mkdir -p /data
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Set static Streamlit configurations
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
ENV STREAMLIT_SERVER_HEADLESS=true
# Launch Streamlit using Railway's dynamic $PORT
CMD ["sh", "-c", "streamlit run layout.py --server.port=$PORT"]
3. Verify the Volume Mount
Once your container actually boots without crashing from the port error, your volume mount should finally work.
Double-check in Railway under Settings > Volumes that your persistent volume is mapped exactly to
/data.Because you are now using a Dockerfile, the volume will be attached properly during the infrastructure boot sequence, avoiding the timing desync you experienced with Nixpacks.
2 hours ago
Confirmed - STREAMLIT_SERVER_PORT is NOT in our variables.
Only Cloudinary vars exist. Railway must be auto-injecting it.
How do we prevent Railway from auto-setting
STREAMLIT_SERVER_PORT for Streamlit apps?
2 hours ago
Update: Confirmed STREAMLIT_SERVER_PORT is NOT in our
service variables. Only Cloudinary vars exist.
But Railway is still injecting STREAMLIT_SERVER_PORT=$PORT
(literal string) automatically.
Even tried ${{PORT}} reference syntax - still same error.
Our Dockerfile CMD:
CMD ["/bin/sh", "-c", "streamlit run layout.py
--server.port $PORT --server.address 0.0.0.0"]
The /bin/sh -c command never seems to execute at all.
Is there a way to see ALL environment variables that
Railway injects at runtime, including auto-generated ones?
Or is there a way to completely disable Railway's
auto-detection for Streamlit?
2 hours ago
Still same error after deleting STREAMLIT_SERVER_PORT
from variables and redeploying.
Railway must be auto-injecting STREAMLIT_SERVER_PORT=$PORT
internally for Streamlit apps even when not set in variables.
Our Dockerfile:
FROM python:3.11-slim
RUN mkdir -p /data
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
ENV STREAMLIT_SERVER_HEADLESS=true
CMD ["/bin/sh", "-c", "streamlit run layout.py --server.port $PORT --server.address 0.0.0.0"]
No STREAMLIT_SERVER_PORT in variables.
Still getting: '$PORT' is not a valid integer
Is Railway auto-injecting this for Streamlit detection?
an hour ago
Update: Resolved temporarily by reverting to Nixpacks.
The Dockerfile approach was failing because Railway was
auto-injecting STREAMLIT_SERVER_PORT=$PORT (literal string)
which Streamlit couldn't parse as an integer. Even hardcoding
STREAMLIT_SERVER_PORT=8080 in Dockerfile ENV and Railway
Variables was being overridden.
Workaround: Reverted to Nixpacks — app is now live at
Remaining issue: Railway Volume (/data) is not mounting
with Nixpacks. The /data directory shows exists=False
in deploy logs despite volume being attached.
Is there a way to use Nixpacks with a properly mounted
volume? Or fix the STREAMLIT_SERVER_PORT injection issue
so we can use Dockerfile builder with volume support?
Thank you for all the help! 
