学校要办场院赛,着手踩坑搭建CTFd了。

直接记录下操作吧

sudo docker swarm init

拿到node

...
Swarm initialized: current node (fe0p8i9wez5v4jss6t3yhmxlc) is now a manager.
...

然后导入集群

docker node update --label-add='name=linux-1' fe0p8i9wez5v4jss6t3yhmxlc

直接把人家配置好的CTFd pull下来

git clone https://gitee.com/yichen115/CTFd.git --depth=1
git submodule update --init

然后docker跑起来

sudo docker-compose up -d

会报错

ERROR: The Compose file './docker-compose.yml' is invalid because:
networks.frp_containers value Additional properties are not allowed ('attachable' was unexpected)

改下docker-compose.yml

sudo vim docker-compose.yml

把networks.frp_containers下的attachable字段直接注释掉

然后再跑起来

sudo docker-compose up -d

等跑完

Creating ctfd_db_1    ... done
Creating ctfd_frps_1  ... done
Creating ctfd_cache_1 ... done
Creating ctfd_ctfd_1  ... done
Creating ctfd_frpc_1  ... done

看下进程

sudo docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS          PORTS                                                                                                      NAMES
65240a8441c2   glzjin/frp:latest   "/usr/local/bin/frpc…"   31 seconds ago   Up 28 seconds                                                                                                              ctfd_frpc_1
0ec1f50870c1   ctfd_ctfd           "/opt/CTFd/docker-en…"   34 seconds ago   Up 31 seconds   0.0.0.0:80->8000/tcp, :::80->8000/tcp                                                                      ctfd_ctfd_1
63b64e591985   mariadb:10.4.12     "docker-entrypoint.s…"   36 seconds ago   Up 34 seconds                                                                                                              ctfd_db_1
942e124c4929   glzjin/frp          "/usr/local/bin/frps…"   36 seconds ago   Up 31 seconds   0.0.0.0:9123->9123/tcp, :::9123->9123/tcp, 0.0.0.0:9125-9129->9125-9129/tcp, :::9125-9129->9125-9129/tcp   ctfd_frps_1
093348fb8595   redis:4             "docker-entrypoint.s…"   36 seconds ago   Up 34 seconds                                                                                                              ctfd_cache_1

直接访问127.0.0.1:8000

完成配置即可完成