Self-host Langflow with Docker Compose
Visual builder for AI agents and retrieval workflows, served as an API or MCP server.
The steps below take a few minutes end to end.
Requirements
You'll need these installed on the machine you're deploying to:
Docker
Packages Langflow and everything it depends on into an isolated container, so it runs the same way on your machine as it does everywhere else.
Install guideDocker Compose
Reads docker-compose.yml and starts everything in it together. Ships with Docker Desktop. On Linux servers it's usually a separate install.
Install guide1. Docker compose setup and file
Create a folder for Langflow and save the file below into it as docker-compose.yml. It describes every container the stack needs — Langflow itself and any supporting services, such as its database — along with the ports, volumes and environment variables each one uses. You'll also need an empty .env file in the same folder; Docker Compose reads it automatically and uses it to fill in the ${VARIABLE} references you'll see in the file below.
docker-compose.yml
version: "3.9"
services:
langflow:
image: langflowai/langflow:latest
restart: unless-stopped
ports:
- 7860:7860
environment:
DO_NOT_TRACK: "true"
LANGFLOW_AUTO_LOGIN: "false"
LANGFLOW_CONFIG_DIR: /app/langflow
LANGFLOW_HOST: 0.0.0.0
LANGFLOW_NEW_USER_IS_ACTIVE: "false"
LANGFLOW_PORT: "7860"
LANGFLOW_SAVE_DB_IN_CONFIG_DIR: "true"
LANGFLOW_SECRET_KEY: ${RANDOM_LANGFLOW_SECRET_KEY}
LANGFLOW_SUPERUSER: admin
LANGFLOW_SUPERUSER_PASSWORD: ${SETUP_ADMIN_PASSWORD}
volumes:
- data:/app/langflow
- home:/app/data
- npm:/app/.npm
- tmp:/tmp
volumes:
data: null
home: null
npm: null
tmp: null
Volumes
Langflow stores its data in named Docker volumes, so it survives container restarts and updates:
- data mounted at /app/langflow: Langflow's SQLite database (users, flows, stored credentials), uploaded files, and its secret key.
- home mounted at /app/data: The runtime user's home directory, used for caches.
- npm mounted at /app/.npm: npm cache for MCP servers that flows start with npx.
- tmp mounted at /tmp: Temporary working files.
2. Secret generation
Langflow needs a few randomly generated secrets — for example, database passwords or an internal session key — before it can start. These are referenced from docker-compose.yml above but don't live in it, so they need to end up in your .env file. Pick one of the two options below.
Generating secrets…
3. Start Langflow with Docker Compose
From the folder with docker-compose.yml and .env, run:
Terminal
Start Langflow and all its supporting services in the background.
docker compose up -dThe -d flag runs the stack in the background so it keeps running after you close the terminal. Docker will pull the images the first time, which can take a minute or two.
To check on it afterwards: docker compose ps shows whether containers are healthy, and docker compose logs -f follows their logs if something looks wrong. Once it's running, open http://localhost:7860 in your browser.