满足条件:
能够访问互联网,并且能够下载镜像。
Use Docker Compose to build Langflow with a persistent PostgreSQL database service:
获取 Langflow 仓库(repository):
git clone https://github.com/langflow-ai/langflow.git
导航到 the docker_example 目录:
cd langflow/docker_example
运行 the Docker Compose 文件:
docker compose up
备注:
后台运行:docker compose up -d
访问 Langflow
root@rocky95 docker_example\]# docker compose up \[+\] Running 5/5 ✔ Network docker_example_default Created 0.3s ✔ Volume "docker_example_langflow-postgres" Created 0.0s ✔ Volume "docker_example_langflow-data" Created 0.0s ✔ Container docker_example-postgres-1 Created 0.3s ✔ Container docker_example-langflow-1 Created 0.3s Attaching to langflow-1, postgres-1 postgres-1 \| The files belonging to this database system will be owned by user "postgres". postgres-1 \| This user must also own the server process. postgres-1 \| postgres-1 \| The database cluster will be initialized with locale "en_US.utf8". postgres-1 \| The default database encoding has accordingly been set to "UTF8". postgres-1 \| The default text search configuration will be set to "english". postgres-1 \| postgres-1 \| Data page checksums are disabled. postgres-1 \| postgres-1 \| fixing permissions on existing directory /var/lib/postgresql/data ... ok postgres-1 \| creating subdirectories ... ok postgres-1 \| selecting dynamic shared memory implementation ... posix postgres-1 \| selecting default max_connections ... 100 postgres-1 \| selecting default shared_buffers ... 128MB postgres-1 \| selecting default time zone ... Etc/UTC postgres-1 \| creating configuration files ... ok postgres-1 \| running bootstrap script ... ok postgres-1 \| performing post-bootstrap initialization ... ok postgres-1 \| syncing data to disk ... ok postgres-1 \| postgres-1 \| initdb: warning: enabling "trust" authentication for local connections postgres-1 \| initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb. postgres-1 \| postgres-1 \| Success. You can now start the database server using: postgres-1 \| postgres-1 \| pg_ctl -D /var/lib/postgresql/data -l logfile start postgres-1 \| postgres-1 \| waiting for server to start....2025-07-28 10:44:31.573 UTC \[48\] LOG: starting PostgreSQL 16.9 (Debian 16.9-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit postgres-1 \| 2025-07-28 10:44:31.591 UTC \[48\] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgres-1 \| 2025-07-28 10:44:31.659 UTC \[51\] LOG: database system was shut down at 2025-07-28 10:44:29 UTC postgres-1 \| 2025-07-28 10:44:31.697 UTC \[48\] LOG: database system is ready to accept connections postgres-1 \| done postgres-1 \| server started postgres-1 \| CREATE DATABASE postgres-1 \| postgres-1 \| postgres-1 \| /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/\* postgres-1 \| postgres-1 \| 2025-07-28 10:44:32.139 UTC \[48\] LOG: received fast shutdown request postgres-1 \| waiting for server to shut down...2025-07-28 10:44:32.217 UTC \[48\] LOG: aborting any active transactions postgres-1 \| .2025-07-28 10:44:32.220 UTC \[48\] LOG: background worker "logical replication launcher" (PID 54) exited with exit code 1 postgres-1 \| 2025-07-28 10:44:32.224 UTC \[49\] LOG: shutting down postgres-1 \| 2025-07-28 10:44:32.255 UTC \[49\] LOG: checkpoint starting: shutdown immediate postgres-1 \| 2025-07-28 10:44:32.761 UTC \[49\] LOG: checkpoint complete: wrote 922 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.087 s, sync=0.345 s, total=0.537 s; sync files=301, longest=0.278 s, average=0.002 s; distance=4255 kB, estimate=4255 kB; lsn=0/1912108, redo lsn=0/1912108 postgres-1 \| 2025-07-28 10:44:32.769 UTC \[48\] LOG: database system is shut down postgres-1 \| done postgres-1 \| server stopped postgres-1 \| postgres-1 \| PostgreSQL init process complete; ready for start up. postgres-1 \| postgres-1 \| 2025-07-28 10:44:32.937 UTC \[1\] LOG: starting PostgreSQL 16.9 (Debian 16.9-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit postgres-1 \| 2025-07-28 10:44:32.938 UTC \[1\] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgres-1 \| 2025-07-28 10:44:32.938 UTC \[1\] LOG: listening on IPv6 address "::", port 5432 postgres-1 \| 2025-07-28 10:44:33.031 UTC \[1\] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgres-1 \| 2025-07-28 10:44:33.098 UTC \[64\] LOG: database system was shut down at 2025-07-28 10:44:32 UTC postgres-1 \| 2025-07-28 10:44:33.131 UTC \[1\] LOG: database system is ready to accept connections ✓ Initializing Langflow... ✓ Checking Environment... ✓ Starting Core Services... ✓ Connecting Database... ✓ Loading Components... ✓ Adding Starter Projects... postgres-1 \| 2025-07-28 10:44:47.820 UTC \[68\] ERROR: relation "alembic_version" does not exist at character 15 postgres-1 \| 2025-07-28 10:44:47.820 UTC \[68\] STATEMENT: SELECT \* FROM alembic_version ▣ Launching Langflow...\[07/28/25 10:44:47\] INFO 2025-07-28 10:44:47 - INFO - service.py:309 langflow-1 \| service - Initializing alembic ✓ Launching Langflow... langflow-1 \| langflow-1 \| ╭─────────────────────────────────────────────────────────────────────────╮ langflow-1 \| │ │ langflow-1 \| │ Welcome to Langflow │ langflow-1 \| │ │ langflow-1 \| │ 🌟 GitHub: Star for updates → https://github.com/langflow-ai/langflow │ langflow-1 \| │ 💬 Discord: Join for support → https://discord.com/invite/EqksyE2EX9 │ langflow-1 \| │ │ langflow-1 \| │ We collect anonymous usage data to improve Langflow. │ langflow-1 \| │ To opt out, set: DO_NOT_TRACK=true in your environment. │ langflow-1 \| │ │ langflow-1 \| │ 🟢 Open Langflow → http://localhost:7860 │ langflow-1 \| │ │ langflow-1 \| ╰─────────────────────────────────────────────────────────────────────────╯ postgres-1 \| 2025-07-28 10:49:33.187 UTC \[62\] LOG: checkpoint starting: time postgres-1 \| 2025-07-28 10:50:08.184 UTC \[62\] LOG: checkpoint complete: wrote 349 buffers (2.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=34.707 s, sync=0.127 s, total=34.997 s; sync files=188, longest=0.102 s, average=0.001 s; distance=2159 kB, estimate=2159 kB; lsn=0/1B2DE20, redo lsn=0/1B2DDE8 langflow-1 \| \[07/28/25 11:22:01\] WARNING 2025-07-28 11:22:01 - WARNING - local local.py:60 langflow-1 \| - File 046-rocket.svg not found in flow langflow-1 \| app/langflow/profile_pictures/Space. langflow-1 \| WARNING 2025-07-28 11:22:01 - WARNING - local local.py:60 langflow-1 \| - File 046-rocket.svg not found in flow langflow-1 \| app/langflow/profile_pictures/Space. postgres-1 \| 2025-07-28 11:24:33.773 UTC \[62\] LOG: checkpoint starting: time postgres-1 \| 2025-07-28 11:24:34.111 UTC \[62\] LOG: checkpoint complete: wrote 2 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.102 s, sync=0.034 s, total=0.339 s; sync files=2, longest=0.034 s, average=0.017 s; distance=1 kB, estimate=1943 kB; lsn=0/1B2E260, redo lsn=0/1B2E228 langflow-1 \| \[07/28/25 12:39:40\] WARNING 2025-07-28 12:39:40 - WARNING - local local.py:60 langflow-1 \| - File 046-rocket.svg not found in flow langflow-1 \| app/langflow/profile_pictures/Space. langflow-1 \| WARNING 2025-07-28 12:39:40 - WARNING - local local.py:60 langflow-1 \| - File 046-rocket.svg not found in flow langflow-1 \| app/langflow/profile_pictures/Space. Gracefully stopping... (press Ctrl+C again to force) \[+\] Stopping 2/2 ✔ Container docker_example-langflow-1 Stopped 3.5s ✔ Container docker_example-postgres-1 Stopped 0.7s \[root@rocky95 docker_example\]#