Host a Streamlit or Gradio App for Free: Dockerfile, Push, HTTPS URL

Streamlit hosting and Gradio hosting on your own container: a private app without a paid plan, secrets in environment variables, a database or an API next to it, and a custom domain when you need one. The exact Dockerfile for each framework is below.

Free tier: 4 containers, 512 MB each, 100 hours a month, 10 deploys a day. No credit card. Always-On from $12 a month, Medium (2 GB) from $25, dedicated GPU from $499.

Last verified 28 September 2026 against the free-tier docs, the deployment code, and the Streamlit Community Cloud and Hugging Face documentation read the same day.

Where to Host a Streamlit or Gradio App for Free in 2026

The four realistic options, with the limits each one states on its own documentation as of 28 September 2026. Two of them changed recently and most tutorials online have not caught up.

Host Free plan Resources Sleeps after Private apps Needs
SnapDeploy4 containers, 100 container-hours a month, no card512 MB, 0.25 vCPU free; 2 GB and 4 GB paid; dedicated T4 or A10G GPU paid15 minutes idle; ~60 s wake; none on Always-OnYes, on the free tierA Dockerfile for Streamlit; a GitHub repo or an image upload
Streamlit Community CloudFree; unlimited public apps, one private appAbout 0.078 to 2 CPU cores and 690 MB to 2.7 GB RAM, shared (their Feb 2024 figures)12 hours without traffic; any viewer can wake itOneA GitHub account with admin rights on the repo; apps hosted in the US only
Hugging Face SpacesStatic Spaces free; Gradio and Docker Spaces need PRO ($9/mo) or Team ($20/user/mo); free personal accounts may host up to 2 Gradio Spaces on ZeroGPUCPU Basic: 2 vCPU, 16 GB, 50 GB non-persistent48 hours idle on free hardware; visitor restarts itProtected and private visibility need a paid planStreamlit runs as a Docker Space; no Streamlit SDK option any more
Render free web service750 instance-hours a month per workspace, no card512 MB, 0.1 CPU15 minutes; about a minute to wakeYesA start command; 5 GB bandwidth a month on the Hobby workspace

Sources: docs.streamlit.io (manage your app: app hibernation and resource limits; status and limitations) and the Streamlit forum FAQ of 1 March 2024 on private apps; huggingface.co/docs/hub (Spaces overview, Spaces GPU and sleep settings) and huggingface.co/pricing; render.com/docs/free and render.com/pricing.

Deploy a Streamlit App on SnapDeploy

Streamlit needs its own server command, so this one takes a five-line Dockerfile. The automatic Python build runs python app.py, which is right for Flask and Gradio but does not start Streamlit.

1.Add a Dockerfile next to app.py

The platform sets a PORT environment variable in every container. Streamlit must listen on it and on all interfaces; the shell form of the command is what expands the variable.

FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8501
CMD ["sh", "-c", "streamlit run app.py --server.port=${PORT:-8501} --server.address=0.0.0.0 --server.headless=true"]

requirements.txt must list streamlit and whatever the app imports. Pin versions; a build that pulls a new major version of pandas is the most common reason a working app breaks on redeploy.

2.Move secrets to environment variables

Community Cloud uses a secrets file; here the same values go into the container's environment variables in the dashboard and are read with os.environ. Nothing secret goes in the repository.

import os
import streamlit as st

api_key = os.environ["OPENAI_API_KEY"]
st.title("Sales dashboard")

3.Connect the repository and deploy

Sign in, choose Deploy from GitHub, pick the repository and branch, add the variables, deploy. The build log streams live; when the image is pushed the container starts and the app is at https://<name>.containers.snapdeploy.app. The health check accepts Streamlit's root page, so no extra route is needed. Every push to the branch redeploys.

4.Pick the size that fits the data

A dashboard over a CSV of a few megabytes runs in the free 512 MB. A large DataFrame, a local model or image processing wants Medium (2 GB, 1 vCPU, $25 a month) or Large (4 GB, 2 vCPU, $45). A model that needs a GPU runs on a dedicated T4 ($499 a month) or A10G ($999) with the same Dockerfile flow. Sizes change without a rebuild.

Deploy a Gradio App on SnapDeploy

To host a Gradio app for free here, no Dockerfile is required: Gradio starts from a normal Python script, so it fits the automatic build. Two things matter: bind to all interfaces and read the port from the environment.

1.Make app.py launch on 0.0.0.0 and PORT

import os
import gradio as gr

def greet(name):
    return f"Hello, {name}!"

demo = gr.Interface(fn=greet, inputs="text", outputs="text")

if __name__ == "__main__":
    demo.launch(server_name="0.0.0.0",
                server_port=int(os.environ.get("PORT", 7860)))

With requirements.txt listing gradio, the automatic Python build installs it and runs python app.py. No Dockerfile is required. Do not use share=True: that creates a temporary tunnel link from Gradio's servers, and the container already has a permanent HTTPS address.

2.Or add a Dockerfile for control

When you need a specific Python version, a system package such as ffmpeg, or model weights baked into the image, commit a Dockerfile and it is used as written.

FROM python:3.11-slim
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 7860
CMD ["python", "app.py"]

3.Models, weights and the GPU question

Small models load fine into a Medium container. Anything that expects CUDA belongs on a dedicated GPU instance, where the same Dockerfile runs with the NVIDIA runtime and one-click PyTorch, Hugging Face and vLLM templates exist. The container's filesystem is ephemeral, so download weights at build time into the image or at start from object storage, not into a folder you expect to survive a restart.

When Community Cloud or Spaces Is Not Enough

Both incumbents are good at what they are for: public demos. These are the cases where people move to a container.

  • More than one private app. Community Cloud allows one private app per account and says it has no plans to sell more. On Hugging Face, protected and private Spaces are paid-plan features. Here every container on the free tier can serve a private repository.
  • A Gradio app without a paid Hugging Face plan. Creating a Gradio or Docker Space now requires PRO or a Team plan, apart from up to two ZeroGPU Spaces for personal accounts in good standing. A Gradio container on SnapDeploy's free tier has no such gate.
  • Your own domain. Neither free incumbent gives you one on the free plan for an app. Always-On does, with the certificate issued for you.
  • A database or an API next to the app. A dashboard that reads from PostgreSQL, or a Gradio front end over a FastAPI backend, is two containers on one account, and managed PostgreSQL, MySQL, MongoDB, Redis and RabbitMQ are add-ons.
  • No GitHub. Community Cloud requires GitHub with admin rights on the repository. Here you can upload a docker save tarball instead.
  • A guaranteed wake-up story for demos. Free containers sleep after 15 minutes, which is shorter than Community Cloud's 12 hours. For a demo day, a $1 Sprint Pack keeps one container awake for 24 hours; for a client-facing app, Always-On never sleeps.

What the Free Tier Gives a Python App

Free Python hosting here follows the same rules as any container; the complete list is on the free-tier page.

  • 4 containers, 512 MB and 0.25 vCPU each, no credit card. Medium and Large sizes run on Always-On.
  • 100 container-hours a month, counted only while a container is awake. A dashboard used a few times a day uses a fraction of it.
  • Sleep after 15 idle minutes, wake in about 60 seconds when someone opens the app in a browser. A script or a scheduled job does not wake it.
  • 10 deploys a day (5 per rolling 12 hours), failed builds included. Builds time out at 60 minutes; most Python builds finish in a few minutes.
  • HTTPS on day one, logs and CPU/memory metrics in the dashboard, environment variables set without a rebuild.
  • Ephemeral disk. Uploaded files and caches vanish on restart; keep state in a database add-on or object storage.

Streamlit and Gradio Hosting Questions, Answered

Can I host a Streamlit app for free on SnapDeploy?

Yes. The free tier runs up to 4 containers with 100 container-hours a month and 10 deploys a day, with no credit card, and a Streamlit app is one container. It sleeps after 15 minutes without visitors and wakes in about 60 seconds when someone opens it in a browser. Always-On at $12 a month keeps it up 24/7.

Do I need a Dockerfile for Streamlit?

Yes, a short one. The automatic Python build starts an app with python app.py, which does not start Streamlit's server. A five-line Dockerfile that installs requirements.txt and runs streamlit run with the platform's PORT variable is all that is needed; it is on this page.

Do I need a Dockerfile for Gradio?

Not necessarily. If app.py calls demo.launch with server_name 0.0.0.0 and the port read from the PORT environment variable, the automatic Python build, which runs python app.py, starts it. A Dockerfile gives you control over the Python version and system packages, and is shown on this page too.

Does the app need a /health route?

No. The platform's health check tries the common health paths and then the root path, and for Python apps any HTTP response counts as alive. Streamlit and Gradio both answer the root path, so no extra route is needed.

How is this different from Streamlit Community Cloud?

Community Cloud is free, needs a GitHub account, allows unlimited public apps but one private app, and hibernates an app after 12 hours without traffic. SnapDeploy sleeps a free app after 15 minutes but allows private apps on the free tier, works without GitHub through an image upload, offers a custom domain and 24/7 uptime on Always-On, and can run a database or an API next to the app.

How is this different from Hugging Face Spaces?

Static Spaces are free for everyone, but creating a Gradio or Docker Space now requires a paid plan: PRO at $9 a month for personal accounts, Team or Enterprise for organisations, with an exception of up to 2 Gradio Spaces on ZeroGPU for free personal accounts in good standing. Free CPU hardware sleeps after 48 hours idle. SnapDeploy's free tier has no plan requirement for a Gradio container; the trade-off is a 15-minute sleep and 512 MB.

Is 512 MB enough for a Streamlit or Gradio app?

For a dashboard over a small dataset or a demo that calls an API, yes. Pandas on a large frame, a local model or heavy image work needs Medium (2 GB, $25 a month) or Large (4 GB, $45). Models that need a GPU run on a dedicated T4 or A10G instance.

Where do I put API keys and secrets?

In the container's environment variables in the dashboard, never in the repository. Read them with os.environ in Python. Values whose names look like secrets are masked in the dashboard.

Proud Member Of

As Seen On

Put Your Streamlit or Gradio App Online Today

Free tier, private repository, no credit card. Always-On from $12 a month when it has to stay up.

Deploy Free Today
FIRST OF ITS KIND

Sprint Pack — $1 for 24 hours

The first managed container PaaS to offer a one-time 24-hour Always-On pass under $5. Unlimited deploys + Always-On for one Small (512 MB) container — including WebSockets & real-time apps. No subscription, no auto-renewal. Stack two for 48 hours.

Need a managed database too? DB Sprint Pack — $1 / 12h for Postgres, MySQL, MariaDB, Mongo, Redis, or RabbitMQ.