[xxxx@xxxx ~]$ docker ps
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/json": dial unix /var/run/docker.sock: connect: permission denied
{"AllowedHosts":"*","ConnectionStrings":{"Database":"Host=db:5432;Database=gzctf;Username=postgres;Password=kunkk"},"EmailConfig":{"SendMailAddress":"a@a.com","UserName":"","Password":"","Smtp":{"Host":"localhost","Port":587}},"XorKey":"xxxx","ContainerProvider":{"Type":"Docker",// or "Kubernetes"
"PortMappingType":"Default",// or "PlatformProxy"
"EnableTrafficCapture":false,"PublicEntry":"ctf.example.com",// or "xxx.xxx.xxx.xxx"
// optional
"DockerConfig":{"SwarmMode":false,"Uri":"unix:///var/run/docker.sock"}},"RequestLogging":false,"DisableRateLimit":true,"RegistryConfig":{"UserName":"","Password":"","ServerAddress":""},"CaptchaConfig":{"Provider":"None",// or "CloudflareTurnstile" or "GoogleRecaptcha"
"SiteKey":"111","SecretKey":"111",// optional
"GoogleRecaptcha":{"VerifyAPIAddress":"https://www.recaptcha.net/recaptcha/api/siteverify","RecaptchaThreshold":"0.5"}},"ForwardedOptions":{"ForwardedHeaders":5,"ForwardLimit":1,"TrustedNetworks":["192.168.12.0/8"]}}
version:"3.0"services:gzctf:image:gztime/gzctf:latestrestart:alwaysenvironment:- "GZCTF_ADMIN_PASSWORD=MYpassword123"ports:- "80:80"volumes:- "./data/files:/app/files"- "./appsettings.json:/app/appsettings.json:ro"# - "./k8sconfig.yaml:/app/k8sconfig.yaml:ro" # this is required for k8s deployment- "/var/run/docker.sock:/var/run/docker.sock"# this is required for docker deploymentdepends_on:- dbdb:image:postgres:alpinerestart:alwaysenvironment:- "POSTGRES_PASSWORD=kunkk"volumes:- "./data/db:/var/lib/postgresql/data"
然后在gzctf文件夹中执行:
1
docker-compose up -d
随后docker ps查看容器ID:
1
2
3
4
sco@sco-virtual-machine:~/gzctf$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ce2011ceac5a gztime/gzctf:latest "dotnet GZCTF.dll" 13 minutes ago Up 4 seconds (health: starting) 0.0.0.0:80->80/tcp, :::80->80/tcp gzctf-gzctf-1
7a335b65fdd2 postgres:alpine "docker-entrypoint.s…" 13 minutes ago Up 3 seconds 5432/tcp gzctf-db-1
docker compose exec db psql -U postgres
psql -U postgres -W
psql (15.2)Type "help"for help.
postgres=# \c gzctfYou are now connected to database "gzctf" as user "postgres".
gzctf=# #do your sql query