安装docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
sudo chmod +x /usr/local/bin/docker-compose
|
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
根据 https://docs.ctf.gzti.me/quick-start 创建appsettings.json和docker-compose.yml
管理员账户密码要大于6位数
docker-compose.yml删掉ks8那行
{ "AllowedHosts": "*", "ConnectionStrings": { "Database": "Host=db:5432;Database=gzctf;Username=postgres;Password=密码" }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } },
"EmailConfig": { "SendMailAddress": "邮箱", "UserName": "", "Password": "", "Smtp": { "Host": "smtp.163.com", "Port": 465 } }, "XorKey": "kali", "ContainerProvider": { "Type": "Docker", "PublicEntry": "服务器公网ip", "DockerConfig": { "SwarmMode": false, "Uri": "" } }, "RequestLogging": false, "DisableRateLimit": false, "RegistryConfig": { "UserName": "", "Password": "", "ServerAddress": "" }, }
|
version: '3.0' services: gzctf: image: gztime/gzctf:latest restart: always environment: - "GZCTF_ADMIN_PASSWORD=密码(大于6位数)" ports: - "80:80" networks: default: volumes: - "./data/files:/app/uploads" - "./appsettings.json:/app/appsettings.json:ro" - "./logs:/app/log" - "./data/keys:/root/.aspnet/DataProtection-Keys" - "/var/run/docker.sock:/var/run/docker.sock" depends_on: - db
db: image: postgres:alpine restart: always environment: - "POSTGRES_PASSWORD=密码(和上个文件的一致)" networks: default: volumes: - "./data/db:/var/lib/postgresql/data"
networks: default: driver: bridge ipam: config: - subnet: 192.168.12.0/24
|
如果管理员账号创建失败,则在网站上手动注册一个账户后,手动在数据库中添加
docker compose exec db psql -U postgres
|
切换表格
UPDATE "AspNetUsers" SET "Role"=3 WHERE "UserName"='刚注册的用户名';
|
至此,安装完毕。