How to build AI workflows visually with Langflow and Docker
May 19, 2026
/
Domantas P.
/
11 min Read
Langflow lets you build AI workflows visually by connecting prompts, large language models (LLMs), APIs, data sources, and logic components on a drag-and-drop canvas. Running Langflow with Docker gives you a consistent environment for creating chatbots, retrieval-augmented generation (RAG) pipelines, multi-agent workflows, and API-based AI applications without manually configuring every dependency.
To install Langflow with Docker, you need a server or local machine with Docker, Docker Compose, access to port 7860, and API keys for the model providers you want to use. This guide explains how to run Langflow with Docker, set it up with Docker Compose and PostgreSQL, deploy it faster with Hostinger’s Langflow Docker template, and keep your workflows persistent during updates.
Prerequisites for installing Langflow with Docker
Before installing Langflow with Docker, make sure you have:
- A local machine or VPS with enough resources to run Langflow.
- Docker installed and running.
- Docker Compose installed for the recommended setup with PostgreSQL and persistent volumes.
- Access to port 7860, which Langflow uses by default.
- A PostgreSQL database or Docker Compose configuration for storing flows, users, settings, and application state.
- API keys for the model providers you want to use, such as OpenAI, Anthropic, Google Gemini, or local model providers.
- A domain and SSL certificate if you plan to run Langflow in production.
You can check whether Docker and Docker Compose are available with:
docker --version docker compose version
How to install Langflow with Docker
You can install Langflow with Docker using either a single docker run command or Docker Compose. The single-container setup is best for quick testing, while Docker Compose is better for VPS deployments because it lets you configure persistent storage, environment variables, and a PostgreSQL database.
1. Install Docker
First, make sure Docker is installed and running on your server or local machine.
Check your Docker version:
docker --version
Then check that Docker Compose is available:
docker compose version
If both commands return version numbers, you can continue with the Langflow installation.
2. Run Langflow with Docker
The fastest way to start Langflow is to run the official Langflow Docker image:
docker run -p 7860:7860 langflowai/langflow:latest
This command downloads the latest Langflow image and maps port 7860 inside the container to port 7860 on your machine. After the container starts, open Langflow in your browser:
http://localhost:7860
If you are installing Langflow on a VPS, replace localhost with your server IP address:
http://your-server-ip:7860
3. Run Langflow in detached mode
For a server deployment, run the container in detached mode, so Langflow continues running after you close the terminal:
docker run -d --name langflow -p 7860:7860 langflowai/langflow:latest
Check whether the container is running:
docker ps
View Langflow logs:
docker logs -f langflow
Stop the container:
docker stop langflow
Start it again:
docker start langflow
This setup is enough for testing Langflow, creating sample AI workflows, and exploring the visual builder. For long-term use, add persistent storage so your flows and settings are not tied only to the container lifecycle.
4. Run Langflow with Docker Compose
Docker Compose is the better option for a VPS because it lets you define Langflow, PostgreSQL, ports, volumes, and environment variables in one configuration file.
Create a new project directory:
mkdir langflow-docker cd langflow-docker
Create a docker-compose.yml file:
nano docker-compose.yml
Add the following configuration:
services: langflow: image: langflowai/langflow:latest container_name: langflow ports: - "7860:7860" environment: - LANGFLOW_DATABASE_URL=postgresql://langflow:strong-password@postgres:5432/langflow - LANGFLOW_CONFIG_DIR=/app/langflow volumes: - langflow-data:/app/langflow depends_on: - postgres restart: unless-stopped postgres: image: postgres:16 container_name: langflow-postgres environment: - POSTGRES_USER=langflow - POSTGRES_PASSWORD=strong-password - POSTGRES_DB=langflow volumes: - langflow-postgres:/var/lib/postgresql/data restart: unless-stopped volumes: langflow-data: langflow-postgres:
Replace strong-password with a secure database password before starting the containers.
Start Langflow:
docker compose up -d
Check the running containers:
docker compose ps
Open Langflow in your browser:
http://your-server-ip:7860
This setup stores Langflow configuration in the langflow-data volume and PostgreSQL data in the langflow-postgres volume. These volumes help preserve your flows, users, and settings when the containers restart or update.
5. Allow access to port 7860
Langflow uses port 7860 by default. If you are running Langflow on a VPS, allow incoming traffic to this port.
For UFW, run:
sudo ufw allow 7860/tcp sudo ufw reload
Then check the firewall status:
sudo ufw status
For production, avoid exposing Langflow directly IP the internet. Use a domain, reverse proxy, HTTPS, and authentication rules to control access to the Langflow interface.
6. Confirm that Langflow is working
After opening Langflow in your browser, create a simple test flow:
- Add a chat input component.
- Add a prompt component.
- Add an LLM component, such as OpenAI or another supported model provider.
- Connect the components on the canvas.
- Add your API key in the provider settings.
- Run the flow from the Langflow interface.
This confirms that the Docker container is running, the Langflow interface is accessible, and the visual AI workflow builder can connect components correctly.
7. Update Langflow with Docker Compose
To update Langflow later, pull the latest image and restart the stack:
docker compose pull docker compose up -d
Because the Compose setup uses persistent volumes, your Langflow data stays separate from the application container. This helps preserve your flows, users, and settings when you update the Docker image.
How to deploy Langflow faster with Hostinger’s Docker template
Manually installing Langflow with Docker gives you full control over the container setup. However, you can deploy it faster with Hostinger’s Langflow VPS template because the Docker environment, application container, and PostgreSQL database are preconfigured for you.
This option is useful if you want to start building AI workflows without manually creating a Docker Compose file, configuring database persistence, or opening the Langflow container from scratch.
To deploy Langflow with Hostinger’s Docker template:
- Go to the Langflow VPS Docker template.
- Choose a VPS plan based on the size of your AI workflows.
- Complete the VPS setup.
- Open hPanel and access your VPS dashboard.
- Launch the preconfigured Langflow template.
- Open the Langflow interface from your VPS IP address or connected domain.
- Add your model provider API keys, such as OpenAI, Anthropic, Google Gemini, or a local model provider.
- Start building workflows on the visual canvas.
Hostinger’s Langflow template includes PostgreSQL for storing flows, users, and application state. This means your Langflow data stays persistent across container restarts and updates.
The template also works with Hostinger’s Docker manager, which lets you manage containers, view logs, and apply updates from a single place. This is helpful when you want the control of a VPS without having to run every Docker command manually.
Use the Hostinger template if you want the fastest setup path. Use manual Docker installation if you need a custom Compose file, custom environment variables, or a more specific infrastructure configuration.
Why use Docker to run Langflow?
Docker is the easiest way to run Langflow because it packages the application and its dependencies. Instead of manually installing Python packages, configuring system libraries, and solving version conflicts, you can start Langflow from a container image and access the visual builder through your browser.
This setup is useful for both local testing and VPS deployment. You can use the same Docker image on your computer, staging server, or production VPS, which makes the Langflow environment more consistent across different systems.
Docker also makes Langflow easier to manage after installation. You can stop, restart, update, or remove the application with simple Docker commands. If you use Docker Compose, you can define the Langflow container, PostgreSQL database, ports, environment variables, and storage volumes in one file.
For long-term projects, Docker helps keep your AI workflows persistent. By using Docker volumes and a PostgreSQL database, Langflow can store flows, user data, settings, and application state outside the main container. This prevents your work from being lost when the container restarts or the Langflow image is updated.
Running Langflow with Docker is especially practical for visual AI workflow development because it gives you:
- Faster setup – start Langflow without manually configuring its full runtime environment.
- Consistent deployment – use the same container setup across local machines and VPS servers.
- Simpler updates – pull a newer image and restart the container when a new Langflow version is available.
- Persistent storage – keep workflows, users, and settings in volumes or PostgreSQL.
- Scalable configuration – extend the setup with databases, reverse proxies, domains, and SSL when moving toward production.
Use Docker if you want a flexible Langflow installation that is easy to reproduce, update, and move between environments. Use a preconfigured Docker template if you want to skip manual setup and start building AI workflows faster.
What can you build with Langflow after installation?
After installing Langflow, you can build AI workflows by connecting prompts, large language models (LLMs), data sources, APIs, and logic components on a visual canvas. Each workflow defines how data enters the system, how the model processes it, and what output the user or application receives.
This makes Langflow useful for testing AI ideas, building internal tools, and creating production-ready AI applications without having to write every integration from scratch.
AI chatbots
Langflow can build AI chatbots that answer user questions, collect information, or guide users through a task. A basic chatbot workflow usually includes a chat input, a prompt template, an LLM provider, a memory component, and a chat output.
For example, you can create a customer support chatbot that receives a question, adds company-specific instructions through a prompt, sends the request to an LLM, and returns a structured answer in the chat interface.
RAG pipelines
Langflow can build retrieval-augmented generation (RAG) pipelines that answer questions using your own documents or knowledge base. A RAG workflow usually connects document loaders, text splitters, embeddings, vector databases, retrievers, prompts, and LLMs.
For example, you can upload product documentation, store it in a vector database, and let the workflow retrieve relevant passages before generating an answer. This helps the model respond based on your source material instead of relying only on its general training data.
Multi-agent workflows
Langflow can build multi-agent workflows where several AI agents complete different parts of a task. Each agent can have a specific role, prompt, model configuration, tool access, or decision step.
For example, one agent can research a topic, another can summarize the findings, and a third can format the final output. This structure is useful for workflows that need planning, validation, routing, or multi-step reasoning.
API-based AI applications
Langflow can turn workflows into API-based AI applications. After creating and testing a flow, you can expose it as an endpoint and connect it to a website, app, chatbot interface, automation tool, or internal dashboard.
For example, a web application can send user input to a Langflow workflow through an API request. Langflow then processes the input with the connected components and returns the generated response to the application.
Internal automation tools
Langflow can also power internal automation workflows for teams. You can connect AI models with business data, prompts, APIs, and conditional steps to automate repetitive knowledge tasks.
For example, a team can build a workflow that summarizes customer feedback, classifies support tickets, drafts email responses, or extracts key information from uploaded documents. This gives non-developer teams a visual way to prototype AI automations before turning them into larger applications.
How to update Langflow without losing data
You can update Langflow without losing data by separating the application container from the files and database that store your workflows. In Docker, this means using persistent volumes for Langflow data and a PostgreSQL database for flows, users, settings, and application state.
Before updating Langflow, check that your current setup uses Docker volumes. Run:
docker volume ls
If you installed Langflow with Docker Compose, your volumes should appear in the list. For the setup used earlier in this guide, the main volumes are:
langflow-data langflow-postgres
These volumes store Langflow configuration and PostgreSQL data outside the container. This lets you replace the Langflow container without deleting your workflows.
To update Langflow with Docker Compose, go to your Langflow project directory:
cd langflow-docker
Pull the latest Langflow image:
docker compose pull
Restart the stack:
docker compose up -d
Docker Compose recreates the application container with the newer image while keeping the same volumes attached. After the update finishes, open Langflow in your browser and confirm that your existing flows, users, and settings are still available.
You can also check the container logs if Langflow does not load after the update:
docker compose logs -f langflow
For single-container installations, update Langflow by stopping and removing the old container, then starting a new one with the same volume attached. For example:
docker stop langflow docker rm langflow docker pull langflowai/langflow:latest docker run -d --name langflow -p 7860:7860 -v langflow-data:/app/langflow langflowai/langflow:latest
Do not remove Docker volumes during the update process. Commands like docker volume rm, docker compose down -v, or docker system prune –volumes can delete persistent Langflow data if used incorrectly.
For safer updates, create a backup before pulling a new image. If your setup uses PostgreSQL, back up the database first:
docker exec langflow-postgres pg_dump -U langflow langflow > langflow-backup.sql
After backing up the database, update Langflow and test the visual builder with an existing workflow. This confirms that the new container version can still access your saved flows and application state.
Common issues when setting up Langflow with Docker
Most Langflow Docker issues are caused by blocked ports, missing volumes, incorrect environment variables, or database connection issues. Start troubleshooting from the container status and logs, then check networking, storage, and credentials.
Langflow container is not running
The Langflow container can stop if the image fails to start, the port is already in use, or the database connection is misconfigured.
Check the container status:
docker ps -a
If you use Docker Compose, run:
docker compose ps
Then check the logs:
docker logs langflow
For Docker Compose:
docker compose logs -f langflow
Look for errors related to missing environment variables, unavailable database hosts, permission issues, or port conflicts. Fix the reported issue, then restart Langflow:
docker restart langflow
For Docker Compose:
docker compose restart
Port 7860 is already in use
Langflow uses port 7860 by default. If another service is already using this port, Docker cannot bind Langflow to it.
Check which process is using the port:
sudo lsof -i :7860
You can either stop the conflicting service or map Langflow to another host port. For example, this command keeps port 7860 inside the container but exposes Langflow on port 8080 on your server:
docker run -d --name langflow -p 8080:7860 langflowai/langflow:latest
Then open Langflow at:
http://your-server-ip:8080
For Docker Compose, update the ports value:
ports: "8080:7860"
After saving the file, restart the stack:
docker compose up -d
Langflow interface does not open in the browser
Langflow may be running correctly even if the browser cannot reach it. This usually happens when the VPS firewall, cloud firewall, or server network rules block the exposed port.
First, confirm that the container is running:
docker ps
Then confirm that Docker exposes the expected port:
docker port langflow
If you use UFW, allow Langflow traffic:
sudo ufw allow 7860/tcp sudo ufw reload
Then open:
http://your-server-ip:7860
If the page still does not load, check whether your VPS provider has a separate firewall panel. The server must allow inbound TCP traffic on the port you mapped to Langflow.
Langflow data disappears after restart
Langflow data can disappear if the container stores flows and settings only inside the container filesystem. Containers are replaceable, so data should be stored in Docker volumes or an external database.
Check whether your setup uses volumes:
docker inspect langflow
For a single-container setup, attach a named volume:
docker run -d --name langflow -p 7860:7860 -v langflow-data:/app/langflow langflowai/langflow:latest
For Docker Compose, define persistent volumes for both Langflow and PostgreSQL:
volumes: langflow-data:/app/langflow
and:
volumes: langflow-postgres:/var/lib/postgresql/data
Use Docker Compose with PostgreSQL for long-term projects because it keeps workflows, users, settings, and application state outside the Langflow application container.
PostgreSQL connection fails
Langflow can fail to connect to PostgreSQL if the database URL, username, password, database name, or service hostname is incorrect.
In Docker Compose, the database hostname should match the PostgreSQL service name. For example, if the service is named postgres, the database URL should use postgres as the host:
LANGFLOW_DATABASE_URL=postgresql://langflow:strong-password@postgres:5432/langflow
Check that the PostgreSQL container is running:
docker compose ps postgres
Then check its logs:
docker compose logs -f postgres
If you changed the database password after the volume was already created, PostgreSQL may still use the original credentials stored in the volume. In that case, update the Langflow database URL to match the existing database credentials or create a fresh database volume only after backing up any needed data.
API keys do not work inside Langflow
Langflow workflows need valid provider credentials to call external model services such as OpenAI, Anthropic, or Google Gemini. If a workflow fails at the model component, the issue is usually an invalid API key, missing provider configuration, or restricted account access.
Open the failing component in Langflow and confirm that the correct API key is set. If you prefer to pass credentials through Docker Compose, add them as environment variables:
environment: OPENAI_API_KEY=your-openai-api-key
Then restart the stack:
docker compose up -d
Avoid hardcoding production API keys in files that are shared publicly or stored in an exposed repository.
Docker Compose changes do not apply
Docker Compose does not always recreate containers after small configuration edits. If you changed ports, environment variables, or volumes, recreate the stack:
docker compose up -d --force-recreate
If you changed the image version, pull the image first:
docker compose pull docker compose up -d
Do not use docker compose down -v unless you intentionally want to remove the associated volumes. The -v flag deletes volume data and can remove saved Langflow workflows or PostgreSQL data.
Next steps after deploying Langflow
After deploying Langflow, start with a simple workflow before building a full AI application. A small test flow helps you confirm that the Docker container, model provider, API keys, and Langflow interface work correctly.
First, create a basic chatbot workflow. Add a chat input, prompt, LLM component, and chat output. Then, connect the components on the canvas and send a test message. This confirms that Langflow can receive user input, process it through the selected model, and return a response.
Next, improve the workflow with your own instructions and data. For example, you can add a system prompt to control the chatbot’s tone, connect a document loader to process files, or add a vector database to build a retrieval-augmented generation (RAG) pipeline. This turns the basic chatbot into a workflow that can answer questions using your own knowledge base.
Then, test the workflow with different inputs. Check whether the model returns accurate answers, follows the prompt, and handles unclear questions correctly. If the output is inconsistent, adjust the prompt, add more context, or change the model settings.
For production use, secure the deployment before sharing it with users. Connect Langflow to a domain, add HTTPS, restrict access to the Langflow interface, and store API keys safely. If you deployed Langflow on a VPS, keep Docker, Langflow, and PostgreSQL up to date to reduce security risks and compatibility issues.
Once the workflow is stable, expose it as an API endpoint and connect it to your application, website, chatbot interface, or internal automation tool. This lets other systems send requests to Langflow and receive AI-generated responses from the workflow you built visually.
If you want to avoid managing the Docker stack manually, use Hostinger’s Langflow VPS Docker template for a faster setup. It gives you a preconfigured Langflow environment with Docker and PostgreSQL, so you can focus on building visual AI workflows instead of maintaining the container configuration.
All of the tutorial content on this website is subject to Hostinger's rigorous editorial standards and values.