DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk11 min

How to Self-Host Langflow with Docker and Build AI Workflows

A practical guide to running Langflow with Docker, adding PostgreSQL persistence through Compose, building prompt and RAG workflows, packaging flows, and publishing the service securely with HTTPS.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The quickest way to self-host Langflow is to run its official Docker image on port 7860. For a durable installation, move to Docker Compose with PostgreSQL, persistent volumes, a configured superuser password, and a pinned Langflow image tag. You can then assemble, save, version, package, and publish AI workflows behind HTTPS.

This guide covers the local installation, a Compose layout, storage and upgrade discipline, workflow construction, flow packaging, and the controls required before exposing Langflow on the internet.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the right deployment shape first

Langflow can be useful in three progressively more operational forms. Start with the smallest form that answers your immediate question, then move up when persistence, collaboration, or public access becomes necessary.

Approach Best for What you gain What you still must manage
Single docker run Trying Langflow on a workstation or disposable VM One command, no Compose file, fast feedback on the UI and port Container replacement, data persistence, database setup, and production security
Docker Compose with PostgreSQL Durable local or server installation Separate application and database services, named storage, environment-file configuration, and repeatable startup Backups, image upgrades, credentials, firewall rules, and reverse proxy configuration
Remote server with a reverse proxy Team or internet-accessible use Domain name, HTTPS termination, access controls, and a stable endpoint Server hardening, certificate lifecycle, monitoring, patching, and incident recovery
Kubernetes or a cloud-specific deployment Organizations that already operate an orchestration platform Scheduling, scaling, health management, and integration with existing infrastructure Cluster operations, secrets, persistent volumes, ingress, and application upgrades

A practical progression is to validate the host with docker run, migrate to the repository’s Compose example when you need durable storage, and add a reverse proxy only after the private installation works.

Prerequisites and a safe first launch

  • A host with Docker Engine and Docker Compose available and running.
  • TCP port 7860 available locally, or intentionally published through your firewall and proxy.
  • A strong value for LANGFLOW_SUPERUSER_PASSWORD. Do not use a password copied into shell history or committed to a repository.
  • A decision about whether this is disposable experimentation or data that must survive container replacement.

The official image defaults to LANGFLOW_AUTO_LOGIN=false. Unless you deliberately enable automatic login, set a superuser password before starting the container.

Run the official image locally

Use this command for the fastest confirmation that Docker, the image, the host port, and the credentials are working:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker run -p 7860:7860 
  -e LANGFLOW_AUTO_LOGIN=false 
  -e LANGFLOW_SUPERUSER_PASSWORD=SUPERUSER_PASSWORD 
  langflowai/langflow:latest

Replace SUPERUSER_PASSWORD with a unique secret. Open http://localhost:7860/ on the Docker host. If Docker is running on a remote machine, localhost refers to that machine, not your laptop; use an SSH tunnel or the server’s controlled address rather than opening the port indiscriminately.

This test is intentionally temporary. Removing the container can remove anything stored only inside its writable layer. Treat it as a smoke test, not as a backup strategy.

Move to Docker Compose for persistent Langflow

The repository’s Docker Compose example separates Langflow from PostgreSQL and supports a .env file. That separation is important: replacing the application container should not replace your database or flow history.

Create an environment file

Keep secrets outside the Compose file and protect the file with operating-system permissions. The variable names used by the documented setup are:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
POSTGRES_USER=langflow
POSTGRES_PASSWORD=replace-with-a-long-random-secret
POSTGRES_DB=langflow
LANGFLOW_DATABASE_URL=postgresql://langflow:replace-with-a-long-random-secret@db:5432/langflow
LANGFLOW_CONFIG_DIR=/app/langflow
LANGFLOW_SUPERUSER_PASSWORD=replace-with-a-different-long-random-secret
LANGFLOW_AUTO_LOGIN=false
LANGFLOW_IMAGE=langflowai/langflow:1.12.0

The database URL must use the Compose service name (here, db) rather than localhost; inside the Langflow container, localhost means the Langflow container itself. Use a URL-encoded password if the password contains characters reserved by connection-string syntax.

Use a two-service Compose file

The following is a compact layout. The repository’s current Compose example remains the authority for image defaults and mount paths; retain those values if they differ from this illustrative file.

services:
  db:
    image: postgres:16
    restart: unless-stopped
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    volumes:
      - postgres_data:/var/lib/postgresql/data

  langflow:
    image: ${LANGFLOW_IMAGE}
    restart: unless-stopped
    depends_on:
      - db
    ports:
      - '127.0.0.1:7860:7860'
    env_file:
      - .env
    volumes:
      - langflow_data:${LANGFLOW_CONFIG_DIR}

volumes:
  postgres_data:
  langflow_data:

Binding the host side of port 7860 to 127.0.0.1 keeps the application private when a reverse proxy on the same server will handle public traffic. If you intentionally need direct LAN access, bind to the host interface you have protected with a firewall instead.

Start it from the directory containing the Compose file and .env:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker compose up -d

Check startup and database connectivity with:

docker compose ps
docker compose logs -f langflow

Wait for the service to finish initialization, then visit http://localhost:7860/ from the host or through your approved tunnel. If the container repeatedly restarts, inspect the first database connection error rather than deleting volumes.

Why two kinds of persistence are useful

  • PostgreSQL volume: stores the deployment’s database records, including saved flow versions. A database backup is therefore part of your flow backup.
  • Langflow configuration volume: keeps application-level data outside the replaceable container. The configured LANGFLOW_CONFIG_DIR determines the path used by your image.
  • External files: documents, model credentials, and other assets referenced by a flow need their own storage and backup plan; a database dump does not automatically copy arbitrary host files.

Named volumes survive docker compose down unless you explicitly remove them. Do not use docker compose down -v on a production project unless you have verified that deleting both volumes is intended.

Back up before changing versions

Pin the Langflow image rather than relying on the mutable latest tag once a flow matters. A release tag such as langflowai/langflow:1.12.0 makes the intended application version visible; pin the registry digest as well when you need byte-for-byte reproducibility.

Before an upgrade, make a database dump and preserve the current image reference:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker compose exec -T db pg_dump 
  -U "$POSTGRES_USER" -d "$POSTGRES_DB" > langflow-before-upgrade.sql

Run the command from a shell where the variables are loaded, or substitute the values explicitly. Store the dump away from the database host and test that it can be read. Back up the Langflow configuration volume and any document directory used by your flows as well.

Test a candidate image with copied data

  1. Restore a copy of the database dump into a non-production PostgreSQL volume.
  2. Start the candidate Langflow image against that copy, not against the live database.
  3. Verify login, flow listing and loading, flow execution, file access, and provider credentials.
  4. Exercise at least one flow for every provider extension you rely on.
  5. Keep the previous image and the production backup until the candidate has passed verification.

Langflow’s image guidance distinguishes base, default, and extended profiles. Choose the smallest profile that contains every provider extension used by your saved flows. If a component’s extension is absent, the flow may load incompletely or fail at runtime; adding the extension later does not repair an already incompatible deployment automatically.

After a database migration, do not point an older application image at the migrated database unless a documented downgrade path exists. A rollback plan should restore both the earlier image and the pre-migration database state.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build your first AI workflow in Langflow

A Langflow flow is a functional representation of an application workflow: it accepts input, transforms it through components, and emits output. Components are the individual steps, and connections carry typed values between their ports.

Start with a blank flow or a template

  1. Create a blank flow, or choose a template from the template gallery.
  2. For a simple conversational test, use a Basic Prompting-style starting point. For retrieval-augmented generation (RAG), use a Vector Store RAG template with separate ingestion and retrieval paths.
  3. Save the flow early, before adding provider credentials, so you can identify the first known-good version.

You can also duplicate an existing flow or import one. Imported flows should be treated as untrusted configuration until you inspect their components, credentials, file paths, and model settings.

Assemble a minimal prompt-to-answer chain

  1. Add a Chat Input component to receive the user’s message.
  2. Add a Prompt or instruction-template component to define the task and insert the incoming message.
  3. Add a Language Model component and configure the provider, model, endpoint, and credential reference.
  4. Add Chat Output to display the model response.
  5. Connect the typed ports in order. A message port carries text between compatible components; a mismatched type will not form a valid edge.
  6. Run the flow with a small test prompt, then save a new version after correcting the prompt or model settings.

When you run a flow, Langflow builds a directed acyclic graph (DAG) from the nodes and edges, validates and prepares the components, sorts nodes by dependency, and executes them in dependency order. A cycle or an unconnected required input prevents a valid execution plan.

Add retrieval-augmented generation

A RAG flow has two related paths. The ingestion path turns source documents into searchable vectors; the question path retrieves relevant chunks and supplies them to the model.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Natmisz:Dive Log Book Scuba Diving, Scuba Log Book, Scuba Diving Equipment Accessories, Gifts For Scuba Divers Men, Leather Logbook Binder, A6 Size Binders 50 Pages
  • This dive logbook is made from genuine cowhide leather, and just like fingerprints, each piece is one-of-a-kind. Each logbook flaunts its own unique personality with varying colors, textures, and markings. Over time, the leather develops its own charming "battle scars," making it even more beautiful and uniquely yours. It's like your favorite pair of jeans – the more you use it, the cooler it gets
  • Its compact A6 size (5.1in x 7.5in) makes it super easy to carry around, letting you jot down your dive logs anytime, anywhere. Whether you toss it in your dive bag or take it on the go, it’s a breeze to bring along. Perfectly suited for A6 dive logs and A6 binders. Think of it as your trusty sidekick – always ready for the next adventure
  • This dive logbook isn't just a pretty face – it's got some serious chops too. The genuine leather cover laughs in the face of splashes, and the 120g high-quality paper ensures your notes won't dissolve into a soggy mess. Perfect for those damp and drizzly dives
  • 3 Card Slots: Perfect for stashing your dive cards, transit passes, and other important cards. 1 Zipper Pocket: Keep your valuables secure and safe. 4 Receipt Pockets: Perfect for holding tickets, passports, and other essential documents We’ve included 2 removable, expandable PVC pages: Transparent PVC Page: Holds up to 3 cards, making them easy to see and use. PVC Storage Bag: Specially designed waterproof bag for those items that just hate getting wet.
  • Our dive logbook includes all the essential fields for divers to record every dive, such as date, dive site, conditions, equipment, dive stats, and dive verification, among others. With 50 pages designed to capture the key details of each dive adventure, it's perfect for PADI divers and fits the A6 size dive log requirements
  1. Choose a document loader that can read your source format.
  2. Split documents into chunks with a chunking component. Keep chunk size and overlap explicit so you can reproduce a version.
  3. Generate embeddings with a provider component available in your selected Docker image profile.
  4. Write the embeddings and metadata to a vector-store component.
  5. On the query side, embed the user’s question with the compatible embedding model.
  6. Use a retriever to select relevant chunks from the vector store.
  7. Insert the retrieved context, the question, and instructions into a context-aware prompt.
  8. Send that prompt to the language model and return the answer through Chat Output.

Keep ingestion and retrieval settings compatible: changing embedding models generally requires re-ingesting documents, and changing collection names can make a correctly running retriever appear empty. Test with a document whose expected answer is unambiguous before adding more data.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Save, version, and move flows safely

Flows are serializable and can be saved and loaded from the Langflow installation’s filesystem. Saved versions are also recorded in the deployment database, which is why a persistent PostgreSQL volume matters for history and recovery.

  • Use meaningful version notes that identify the model, prompt, embedding model, and data collection changed.
  • Keep provider credentials in environment or secret-management facilities rather than embedding them in exported JSON.
  • Export a flow only after removing machine-specific paths and checking that every referenced component exists in the destination image profile.
  • When moving between hosts, restore the database or import the flow JSON, then recreate external files and credentials deliberately.

Package a prebuilt flow into a Docker image

For a repeatable demo or internal distribution, place one or more flow JSON files in a project directory and build a derived image:

FROM langflowai/langflow:latest
RUN mkdir /app/flows
COPY ./*.json /app/flows/
ENV LANGFLOW_LOAD_FLOWS_PATH=/app/flows

Build and run it locally:

docker build -t my-langflow-flows:1.0.0 .
docker run -p 7860:7860 
  -e LANGFLOW_AUTO_LOGIN=false 
  -e LANGFLOW_SUPERUSER_PASSWORD=replace-this-secret 
  my-langflow-flows:1.0.0

Use a versioned base image rather than latest for an actual deployment, and pin its digest when reproducibility is a requirement. If you publish the derived image to a registry, keep the flow JSON and the base-image reference under source control so another operator can rebuild it.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Publish Langflow with HTTPS

The deployment guidance describes four practical directions: a remote Docker server with Caddy as a reverse proxy, Nginx with Let’s Encrypt for automatic certificates, Kubernetes, and cloud-provider-specific instructions. The choice should follow the infrastructure you already operate; it does not remove the need for authentication, persistent storage, and backups.

Reverse-proxy pattern

  1. Point a DNS name to the server and allow only the ports required for HTTPS and administration.
  2. Keep Langflow bound to loopback or a private container network, as in the Compose example.
  3. Configure the proxy to forward HTTPS requests to the Langflow service on port 7860.
  4. Enable automatic certificate issuance and renewal through your chosen proxy and certificate authority.
  5. Set a strong superuser password before the first public request. Do not enable auto-login merely to simplify the proxy.
  6. Test login, flow loading, execution, file access, and provider calls through the public hostname.

Do not expose PostgreSQL to the internet. Restrict its network to the Compose application and backup paths. Add an identity-aware access layer or VPN when the Langflow UI is for a small internal group rather than anonymous public users.

Public-deployment checklist

  • HTTPS is valid for the exact hostname users enter.
  • Port 7860 is not publicly reachable unless that is an intentional, protected design.
  • Superuser credentials are unique, long, and stored outside source control.
  • Database, configuration, flow JSON, and referenced documents have tested backups.
  • Image tags and digests are recorded, with a previous known-good image retained during upgrades.
  • Logs are monitored for repeated login failures, provider errors, and restart loops.
  • Outbound access is limited where possible; model-provider keys are scoped to the minimum permissions needed.

Troubleshoot by symptom

Symptom Likely cause Action
The browser cannot connect Container stopped, port conflict, or a loopback binding viewed from another machine Run docker compose ps, inspect docker compose logs -f langflow, confirm the host port, and use a tunnel or proxy for a remote host.
Login fails immediately Missing or changed superuser password variable Check the effective environment without printing secrets into shared logs, restart with the intended secret, and avoid enabling auto-login as a workaround.
Langflow cannot reach PostgreSQL Wrong hostname, credentials, database name, or startup timing Use the Compose service name in LANGFLOW_DATABASE_URL, verify the three PostgreSQL variables match, and inspect both service logs.
Flows disappear after recreation Database or configuration volume was not mounted, or volumes were removed Confirm named volumes with docker volume ls, inspect the Compose mounts, and restore the database backup if data was deleted.
A saved flow has a missing component The selected image profile does not include its provider extension Choose a profile containing that extension, pin the image, restart, and rerun the flow against a test copy before production.
RAG returns no useful context Ingestion did not complete, collection settings differ, or embedding models are incompatible Verify document loading and vector-store writes separately, check collection and embedding settings, and test retrieval with a known query.
An upgrade starts but old data will not open Database migration changed the schema Stop the old image against the migrated database, restore the pre-upgrade backup, and follow a documented downgrade path instead of guessing.

A repeatable operating routine

  1. Record the Langflow image tag and digest, Compose file, environment-variable names, and volume names.
  2. Back up PostgreSQL and external flow assets on a schedule appropriate to the value of the work.
  3. Before each image or profile change, clone the data, run the smoke tests, and retain the prior image.
  4. After deployment, test one minimal prompt flow and one representative RAG flow through the same endpoint users will access.
  5. Review provider credentials, firewall rules, certificate renewal, and logs regularly.

This operating pattern keeps the fast Docker workflow available for experimentation while giving the Compose deployment the persistence and rollback controls expected of a service.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.