1.准备 docker 及 docker-compose 环境
2.准备docker-compose.yml
文件
version: '3.3'
services:
master:
image: tikazyq/crawlab:0.4.10
container_name: master
environment:
CRAWLAB_SERVER_MASTER: "Y" # whether to be master node 是否为主节点,主节点为 Y,工作节点为 N
CRAWLAB_MONGO_HOST: "mongo" # MongoDB host address MongoDB 的地址,在 docker compose 网络中,直接引用服务名称
CRAWLAB_REDIS_ADDRESS: "redis" # Redis host address Redis 的地址,在 docker compose 网络中,直接引用服务名称
volumes: # 卷映射格式 "宿主:容器"
- "/opt/docker/crawlab/spiders/:/app/spiders/" # 持久化爬虫项目文件到宿主机本地
ports: # 端口映射格式 "宿主:容器"
- "8080:8080" # frontend 开放前端页面访问端口
depends_on:
- mongo
- redis
worker:
image: tikazyq/crawlab:0.4.10
container_name: worker
environment:
CRAWLAB_SERVER_MASTER: "N"
CRAWLAB_MONGO_HOST: "mongo"
CRAWLAB_REDIS_ADDRESS: "redis"
depends_on:
- mongo
- redis
mongo:
image: mongo:4.2
restart: always
redis:
image: redis:7.0.2
restart: always
3.终端执行 docker-compose up -d
4.访问并登录: http://127.0.0.1:8080
ps:
需指定mongo
版本,用mongo:latest
可能会导致登录出现502问题;
将自动生成的ssh私钥
配置到git账号