{"id":147648,"date":"2026-05-24T05:18:11","date_gmt":"2026-05-24T05:18:11","guid":{"rendered":"\/ng\/tutorials\/build-ai-workflows-with-langflow-docker"},"modified":"2026-05-24T05:18:11","modified_gmt":"2026-05-24T05:18:11","slug":"build-ai-workflows-with-langflow-docker","status":"publish","type":"post","link":"\/ng\/tutorials\/build-ai-workflows-with-langflow-docker","title":{"rendered":"How to build AI workflows visually with Langflow and Docker"},"content":{"rendered":"<p>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.<\/p><p>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&rsquo;s Langflow Docker template, and keep your workflows persistent during updates.<\/p><h2 class=\"wp-block-heading\" id=\"h-prerequisites-for-installing-langflow-with-docker\">Prerequisites for installing Langflow with Docker<\/h2><p>Before installing Langflow with Docker, make sure you have:<\/p><ul class=\"wp-block-list\">\n<li>A local machine or <a href=\"\/ng\/tutorials\/what-is-vps-hosting\">VPS<\/a> with enough resources to run Langflow.<\/li>\n\n\n\n<li><a href=\"\/ng\/tutorials\/how-to-install-docker-on-ubuntu\">Docker installed<\/a> and running.<\/li>\n\n\n\n<li>Docker Compose installed for the recommended setup with PostgreSQL and persistent volumes.<\/li>\n\n\n\n<li>Access to port 7860, which Langflow uses by default.<\/li>\n\n\n\n<li>A <a href=\"\/ng\/tutorials\/how-to-install-postgresql-on-ubuntu\">PostgreSQL database<\/a> or Docker Compose configuration for storing flows, users, settings, and application state.<\/li>\n\n\n\n<li>API keys for the model providers you want to use, such as OpenAI, Anthropic, Google Gemini, or local model providers.<\/li>\n\n\n\n<li>A domain and SSL certificate if you plan to run Langflow in production.<\/li>\n<\/ul><p>You can check whether Docker and Docker Compose are available with:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker --version\ndocker compose version<\/pre><h2 class=\"wp-block-heading\" id=\"h-how-to-install-langflow-with-docker\">How to install Langflow with Docker<\/h2><p>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.<\/p><h3 class=\"wp-block-heading\">1. Install Docker<\/h3><p>First, make sure Docker is installed and running on your server or local machine.<\/p><p>Check your Docker version:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker --version<\/pre><p>Then check that Docker Compose is available:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose version<\/pre><p>If both commands return version numbers, you can continue with the Langflow installation.<\/p><h3 class=\"wp-block-heading\">2. Run Langflow with Docker<\/h3><p>The fastest way to start Langflow is to run the official Langflow Docker image:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run -p 7860:7860 langflowai\/langflow:latest<\/pre><p>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:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/localhost:7860<\/pre><p>If you are installing Langflow on a VPS, replace localhost with your server IP address:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/your-server-ip:7860<\/pre><h3 class=\"wp-block-heading\">3. Run Langflow in detached mode<\/h3><p>For a server deployment, run the container in detached mode, so Langflow continues running after you close the terminal:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run -d\n--name langflow\n-p 7860:7860\nlangflowai\/langflow:latest<\/pre><p>Check whether the container is running:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker ps<\/pre><p>View Langflow logs:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker logs -f langflow<\/pre><p>Stop the container:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker stop langflow<\/pre><p>Start it again:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker start langflow<\/pre><p>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.<\/p><h3 class=\"wp-block-heading\">4. Run Langflow with Docker Compose<\/h3><p><a href=\"\/ng\/tutorials\/what-is-docker-compose\">Docker Compose<\/a> is the better option for a VPS because it lets you define Langflow, PostgreSQL, ports, volumes, and environment variables in one configuration file.<\/p><p>Create a new project directory:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir langflow-docker\ncd langflow-docker<\/pre><p>Create a docker-compose.yml file:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">nano docker-compose.yml<\/pre><p>Add the following configuration:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">services:\nlangflow:\nimage: langflowai\/langflow:latest\ncontainer_name: langflow\nports:\n- \"7860:7860\"\nenvironment:\n- LANGFLOW_DATABASE_URL=postgresql:\/\/langflow:strong-password@postgres:5432\/langflow\n- LANGFLOW_CONFIG_DIR=\/app\/langflow\nvolumes:\n- langflow-data:\/app\/langflow\ndepends_on:\n- postgres\nrestart: unless-stopped\npostgres:\nimage: postgres:16\ncontainer_name: langflow-postgres\nenvironment:\n- POSTGRES_USER=langflow\n- POSTGRES_PASSWORD=strong-password\n- POSTGRES_DB=langflow\nvolumes:\n- langflow-postgres:\/var\/lib\/postgresql\/data\nrestart: unless-stopped\nvolumes:\nlangflow-data:\nlangflow-postgres:<\/pre><p>Replace strong-password with a secure database password before starting the containers.<\/p><p>Start Langflow:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d<\/pre><p>Check the running containers:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose ps<\/pre><p>Open Langflow in your browser:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/your-server-ip:7860<\/pre><p>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.<\/p><h3 class=\"wp-block-heading\">5. Allow access to port 7860<\/h3><p>Langflow uses port 7860 by default. If you are running Langflow on a VPS, allow incoming traffic to this port.<\/p><p>For UFW, run:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw allow 7860\/tcp\nsudo ufw reload<\/pre><p>Then check the firewall status:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw status<\/pre><p>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.<\/p><h3 class=\"wp-block-heading\">6. Confirm that Langflow is working<\/h3><p>After opening Langflow in your browser, create a simple test flow:<\/p><ol class=\"wp-block-list\">\n<li>Add a chat input component.<\/li>\n\n\n\n<li>Add a prompt component.<\/li>\n\n\n\n<li>Add an LLM component, such as OpenAI or another supported model provider.<\/li>\n\n\n\n<li>Connect the components on the canvas.<\/li>\n\n\n\n<li>Add your API key in the provider settings.<\/li>\n\n\n\n<li>Run the flow from the Langflow interface.<\/li>\n<\/ol><p>This confirms that the Docker container is running, the Langflow interface is accessible, and the visual AI workflow builder can connect components correctly.<\/p><h3 class=\"wp-block-heading\">7. Update Langflow with Docker Compose<\/h3><p>To update Langflow later, pull the latest image and restart the stack:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose pull\ndocker compose up -d<\/pre><p>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.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-deploy-langflow-faster-with-hostingers-docker-template\">How to deploy Langflow faster with Hostinger&rsquo;s Docker template<\/h2><p>Manually installing Langflow with Docker gives you full control over the container setup. However, you can deploy it faster with Hostinger&rsquo;s Langflow VPS template because the Docker environment, application container, and PostgreSQL database are preconfigured for you.<\/p><p>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.<\/p><p>To deploy Langflow with Hostinger&rsquo;s Docker template:<\/p><ol class=\"wp-block-list\">\n<li>Go to the<a data-wpel-link=\"internal\" href=\"\/ng\/vps\/docker\/langflow?utm_source=chatgpt.com\" rel=\"follow\"> <\/a><a href=\"\/ng\/vps\/docker\/langflow\">Langflow VPS Docker template<\/a>.<\/li>\n\n\n\n<li>Choose a VPS plan based on the size of your AI workflows.<\/li>\n\n\n\n<li>Complete the VPS setup.<\/li>\n\n\n\n<li>Open hPanel and access your VPS dashboard.<\/li>\n\n\n\n<li>Launch the preconfigured Langflow template.<\/li>\n\n\n\n<li>Open the Langflow interface from your VPS IP address or connected domain.<\/li>\n\n\n\n<li>Add your model provider API keys, such as OpenAI, Anthropic, Google Gemini, or a local model provider.<\/li>\n\n\n\n<li>Start building workflows on the visual canvas.<\/li>\n<\/ol><p>Hostinger&rsquo;s Langflow template includes PostgreSQL for storing flows, users, and application state. This means your Langflow data stays persistent across container restarts and updates.<\/p><p>The template also works with Hostinger&rsquo;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.<\/p><p>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.<\/p><h2 class=\"wp-block-heading\" id=\"h-why-use-docker-to-run-langflow\">Why use Docker to run Langflow?<\/h2><p>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.<\/p><p>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.<\/p><p>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.<\/p><p>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.<\/p><p>Running Langflow with Docker is especially practical for visual AI workflow development because it gives you:<\/p><ul class=\"wp-block-list\">\n<li><strong>Faster setup<\/strong> &ndash; start Langflow without manually configuring its full runtime environment.<\/li>\n\n\n\n<li><strong>Consistent deployment<\/strong> &ndash; use the same container setup across local machines and VPS servers.<\/li>\n\n\n\n<li><strong>Simpler updates<\/strong> &ndash; pull a newer image and restart the container when a new Langflow version is available.<\/li>\n\n\n\n<li><strong>Persistent storage<\/strong> &ndash; keep workflows, users, and settings in volumes or PostgreSQL.<\/li>\n\n\n\n<li><strong>Scalable configuration<\/strong> &ndash; extend the setup with databases, reverse proxies, domains, and SSL when moving toward production.<\/li>\n<\/ul><p>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.<\/p><h2 class=\"wp-block-heading\" id=\"h-what-can-you-build-with-langflow-after-installation\">What can you build with Langflow after installation?<\/h2><p>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.<\/p><p>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.<\/p><h3 class=\"wp-block-heading\">AI chatbots<\/h3><p>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.<\/p><p>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.<\/p><h3 class=\"wp-block-heading\">RAG pipelines<\/h3><p>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.<\/p><p>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.<\/p><h3 class=\"wp-block-heading\">Multi-agent workflows<\/h3><p>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.<\/p><p>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.<\/p><h3 class=\"wp-block-heading\">API-based AI applications<\/h3><p>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.<\/p><p>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.<\/p><h3 class=\"wp-block-heading\">Internal automation tools<\/h3><p>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.<\/p><p>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.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-update-langflow-without-losing-data\">How to update Langflow without losing data<\/h2><p>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.<\/p><p>Before updating Langflow, check that your current setup uses Docker volumes. Run:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker volume ls<\/pre><p>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:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">langflow-data\nlangflow-postgres<\/pre><p>These volumes store Langflow configuration and PostgreSQL data outside the container. This lets you replace the Langflow container without deleting your workflows.<\/p><p>To update Langflow with Docker Compose, go to your Langflow project directory:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd langflow-docker<\/pre><p>Pull the latest Langflow image:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose pull<\/pre><p>Restart the stack:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d<\/pre><p>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.<\/p><p>You can also check the container logs if Langflow does not load after the update:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose logs -f langflow<\/pre><p>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:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker stop langflow\ndocker rm langflow\ndocker pull langflowai\/langflow:latest\ndocker run -d\n--name langflow\n-p 7860:7860\n-v langflow-data:\/app\/langflow\nlangflowai\/langflow:latest<\/pre><p>Do not remove Docker volumes during the update process. Commands like docker volume rm, docker compose down -v, or docker system prune &ndash;volumes can delete persistent Langflow data if used incorrectly.<\/p><p>For safer updates, create a backup before pulling a new image. If your setup uses PostgreSQL, back up the database first:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec langflow-postgres pg_dump -U langflow langflow &gt; langflow-backup.sql<\/pre><p>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.<\/p><h2 class=\"wp-block-heading\" id=\"h-common-issues-when-setting-up-langflow-with-docker\">Common issues when setting up Langflow with Docker<\/h2><p>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.<\/p><h3 class=\"wp-block-heading\">Langflow container is not running<\/h3><p>The Langflow container can stop if the image fails to start, the port is already in use, or the database connection is misconfigured.<\/p><p>Check the container status:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker ps -a<\/pre><p>If you use Docker Compose, run:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose ps<\/pre><p>Then check the logs:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker logs langflow<\/pre><p>For Docker Compose:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose logs -f langflow<\/pre><p>Look for errors related to missing environment variables, unavailable database hosts, permission issues, or port conflicts. Fix the reported issue, then restart Langflow:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker restart langflow<\/pre><p>For Docker Compose:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose restart<\/pre><h3 class=\"wp-block-heading\">Port 7860 is already in use<\/h3><p>Langflow uses port 7860 by default. If another service is already using this port, Docker cannot bind Langflow to it.<\/p><p>Check which process is using the port:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo lsof -i :7860<\/pre><p>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:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run -d\n--name langflow\n-p 8080:7860\nlangflowai\/langflow:latest<\/pre><p>Then open Langflow at:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/your-server-ip:8080<\/pre><p>For Docker Compose, update the ports value:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ports:\n\"8080:7860\"<\/pre><p>After saving the file, restart the stack:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d<\/pre><h3 class=\"wp-block-heading\">Langflow interface does not open in the browser<\/h3><p>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.<\/p><p>First, confirm that the container is running:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker ps<\/pre><p>Then confirm that Docker exposes the expected port:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker port langflow<\/pre><p>If you use UFW, allow Langflow traffic:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo ufw allow 7860\/tcp\nsudo ufw reload<\/pre><p>Then open:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">http:\/\/your-server-ip:7860<\/pre><p>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.<\/p><h3 class=\"wp-block-heading\">Langflow data disappears after restart<\/h3><p>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.<\/p><p>Check whether your setup uses volumes:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker inspect langflow<\/pre><p>For a single-container setup, attach a named volume:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker run -d\n--name langflow\n-p 7860:7860\n-v langflow-data:\/app\/langflow\nlangflowai\/langflow:latest<\/pre><p>For Docker Compose, define persistent volumes for both Langflow and PostgreSQL:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">volumes:\nlangflow-data:\/app\/langflow<\/pre><p>and:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">volumes:\nlangflow-postgres:\/var\/lib\/postgresql\/data<\/pre><p>Use Docker Compose with PostgreSQL for long-term projects because it keeps workflows, users, settings, and application state outside the Langflow application container.<\/p><h3 class=\"wp-block-heading\">PostgreSQL connection fails<\/h3><p>Langflow can fail to connect to PostgreSQL if the database URL, username, password, database name, or service hostname is incorrect.<\/p><p>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:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">LANGFLOW_DATABASE_URL=postgresql:\/\/langflow:strong-password@postgres:5432\/langflow<\/pre><p>Check that the PostgreSQL container is running:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose ps postgres<\/pre><p>Then check its logs:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose logs -f postgres<\/pre><p>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.<\/p><h3 class=\"wp-block-heading\">API keys do not work inside Langflow<\/h3><p>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.<\/p><p>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:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">environment:\nOPENAI_API_KEY=your-openai-api-key<\/pre><p>Then restart the stack:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d<\/pre><p>Avoid hardcoding production API keys in files that are shared publicly or stored in an exposed repository.<\/p><h3 class=\"wp-block-heading\">Docker Compose changes do not apply<\/h3><p>Docker Compose does not always recreate containers after small configuration edits. If you changed ports, environment variables, or volumes, recreate the stack:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d --force-recreate<\/pre><p>If you changed the image version, pull the image first:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose pull\ndocker compose up -d<\/pre><p>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.<\/p><h2 class=\"wp-block-heading\" id=\"h-next-steps-after-deploying-langflow\">Next steps after deploying Langflow<\/h2><p>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.<\/p><p>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.<\/p><p>Next, improve the workflow with your own instructions and data. For example, you can add a system prompt to control the chatbot&rsquo;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.<\/p><p>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.<\/p><p>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.<\/p><p>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.<\/p><p>If you want to avoid managing the Docker stack manually, use Hostinger&rsquo;s <a href=\"\/ng\/vps\/docker\/langflow\">Langflow VPS Docker template<\/a> 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/build-ai-workflows-with-langflow-docker\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":342,"featured_media":147649,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to build AI workflows with Langflow and Docker","rank_math_description":"Learn how to install Langflow with Docker, deploy it with Docker Compose, build visual AI workflows, and run it faster using Hostinger's Docker template.","rank_math_focus_keyword":"langflow docker","footnotes":""},"categories":[22644],"tags":[],"class_list":["post-147648","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/build-ai-workflows-with-langflow-docker","default":1},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/build-ai-workflows-with-langflow-docker","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/build-ai-workflows-with-langflow-docker","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/build-ai-workflows-with-langflow-docker","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/build-ai-workflows-with-langflow-docker","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/build-ai-workflows-with-langflow-docker","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/build-ai-workflows-with-langflow-docker","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/build-ai-workflows-with-langflow-docker","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/147648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/342"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=147648"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/147648\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media\/147649"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=147648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=147648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=147648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}