Files
nexus/wiki/sources/n8n-docker-install-update.md
2026-04-17 09:34:39 +08:00

103 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "n8n Docker install & update"
type: source
tags: [docker, n8n, workflow]
date: 2026-04-17
---
## Source File
- [[raw/Agent/n8n docker install & update.md]]
## Summary
- 核心主题n8n 工作流自动化工具的 Docker 部署与网络代理配置
- 问题域Docker 容器化部署、网络代理配置、宿主机代理访问
- 方法/机制Docker Compose 编排、Dockerfile 自定义镜像、SOCKS5 代理配置
- 结论/价值:实现 n8n 容器内科学上网,支持工作流自动化执行
## Key Claims
- n8n 可通过 Docker Compose 快速部署,配置数据卷持久化
- 容器内网络流量可通过 SOCKS5 代理访问外网
- 需将宿主机代理监听地址改为 `0.0.0.0` 使容器可访问
- Docker 网桥 IPGateway可通过 `docker network inspect` 获取
## Key Quotes
> "注意:`172.21.0.1` 需替换为以下命令输出的网桥 IPGateway"
> "V2Ray/Tuic 配置中 **本地监听地址改为 `0.0.0.0`**,端口假设为 `10808`"
## Key Concepts
- [[Docker]]:容器化平台
- [[Docker-Compose]]Docker 编排工具,定义多容器应用
- [[Dockerfile]]:容器镜像构建文件
- [[SOCKS5代理]]:支持 TCP/UDP 的网络代理协议
- [[Docker-网桥]]Docker 虚拟网桥,容器与宿主机通信的桥梁
## Key Entities
- [[n8n]]:开源工作流自动化工具
## Connections
- [[n8n]] ← runs_in ← [[Docker]]
- [[Docker]] ← uses ← [[Docker-Compose]]
- [[Docker]] ← built_from ← [[Dockerfile]]
- [[n8n]] ← accesses_network_via ← [[SOCKS5代理]]
## Contradictions
- (暂无)
---
## Docker Compose 配置
```yaml
version: '3.8'
services:
n8n:
build: .
image: docker.n8n.io/n8nio/n8n
container_name: n8n
ports:
- "5678:5678"
volumes:
- n8n_data:/home/node/.n8n
environment:
- N8N_PROTOCOL=https
- N8N_HOST=n8n.ishenwei.online
- WEBHOOK_URL=https://n8n.ishenwei.online/
- N8N_TRUST_PROXY=true
- N8N_SECURE_COOKIE=true
- N8N_PROXY_HOPS=1
- ALL_PROXY=socks5://172.21.0.1:10808
restart: unless-stopped
volumes:
n8n_data:
networks:
n8n_default:
external: true
```
## Dockerfile 配置
```dockerfile
FROM n8nio/n8n:latest
USER root
RUN apk update && apk add --no-cache curl wget
USER node
```
## 更新步骤
```bash
cd /path/to/your/compose/file/directory
docker compose pull
docker compose down
docker compose up -d
```
## 容器内测试代理
```bash
docker exec -it n8n /bin/sh
curl --socks5 172.18.0.1:10808 https://ifconfig.me
```