Skip to content

Compose support ​

The platform converts the compose file into Kubernetes objects. Most of what you'd use in a challenge works, but some Compose features have no equivalent, and some are left out for security. ctfgarden lint checks all of this for you: it warns about everything the platform ignores, and fails on everything that stops the challenge from deploying.

At the top level, only services and volumes are used (plus the x-ctf- extensions). networks, secrets, configs, include and name are ignored.

Unknown fields

The platform's compose parser rejects fields it doesn't know. A typo like imgae: makes the whole challenge fail to load, so run ctfgarden lint before pushing.

Services ​

Supported: image, build, command, entrypoint, environment, env_file, working_dir, user, group_add, ports, expose, volumes, tmpfs, shm_size, read_only, cap_add, cap_drop, privileged, init, tty, stdin_open, stop_signal, stop_grace_period, hostname, domainname, extra_hosts, dns, dns_opt, dns_search, labels, annotations, container_name, cpus, cpu_count, mem_limit, mem_reservation, scale, deploy, runtime, pull_policy.

Some of these work a bit differently:

FieldNotes
buildThe image is built by the platform (Administration → Builds) and shared by all teams. Only context, dockerfile and args are used, so the last stage of a multi-stage Dockerfile is built. If image is set too, the built image isn't used
privileged, cap_addThe service runs in a lightweight VM (Kata Containers) instead of a container. You have the privileges inside the VM, but no access to host devices
userOnly numeric user IDs, not user names
volumesOnly named volumes, tmpfs, and bind mounts from the data directory. Mounts are always writable: :ro and read_only: true are ignored
portsExposed over TLS, see exposing services. host_ip isn't supported, mode is ignored
deployOnly replicas and labels. Use cpus and mem_limit instead of deploy.resources
labels, annotationsSet on the pods
pull_policybuild isn't supported
runtimeIgnored for services that run in a VM

Ignored (they work with ctfgarden compose locally, but not on the platform):

FieldWhat happens instead
depends_onAll services start at the same time. Make your services retry until their dependencies are up
restartContainers that exit are always restarted
healthcheckNot converted to Kubernetes probes
links, external_linksServices reach each other by their name anyway
loggingLogs are collected by the cluster
extendsNot resolved, copy the fields instead
volumes_fromDeclare the volumes on each service
configs, secretsUse environment variables or files
cpu_shares, cpu_quota, cpu_period, cpu_percent, cpu_rt_period, cpu_rt_runtime, cpuset, blkio_configUse cpus
devices, device_cgroup_rules, cgroup, cgroup_parent, ipc, uts, userns_mode, attach, develop, credential_spec, isolationNot available

Not supported (the challenge can't be deployed): networks and network_mode (all services of an instance share one network, use a network policy to restrict it), sysctls, ulimits, security_opt, pid, pids_limit, platform, profiles, mac_address, mem_swappiness, memswap_limit, oom_kill_disable, oom_score_adj, storage_opt.

Volumes ​

Named volumes are created per instance. Set their size with x-size, everything else (driver, driver_opts, labels, name) is ignored, and external volumes aren't supported:

YAML
services:
    db:
        image: postgres:18
        volumes:
            - db-data:/var/lib/postgresql

volumes:
    db-data:
        x-size: 500Mi

The data directory ​

Bind mounts only work from the data/ directory of the challenge. Its contents (with templates rendered for the team) are copied into a volume for every instance before it starts, and mounted where you bind-mount them:

YAML
services:
    web:
        image: nginx:alpine
        volumes:
            - ./data/html:/usr/share/nginx/html
            - ./data/flag.txt:/flag.txt   # from data/flag.txt.plf

Set the size of that volume with data_pvc_size in the metadata. Changes an instance makes to it are lost when the instance stops.

Network policies ​

By default, services can talk to each other, to the cluster's DNS and to the internet. Restrict that with x-ctf-network-policy on a service, or at the top level for all services. As soon as you add a policy, everything it doesn't allow is dropped:

YAML
services:
    bot:
        image: my-admin-bot
        x-ctf-network-policy:
            outgoing:
                rules:
                    - other_party: Challenge      # Challenge, ClusterDns or World
                    - other_party: ClusterDns
                      ports:                      # optional, all ports if left out
                        - port: 53
                          protocols: [UDP, TCP]

Only outgoing traffic can be restricted. An invalid policy is ignored by the platform without an error, ctfgarden lint reports it.

Extensions ​

The platform reads these extensions, other x- keys are allowed (for YAML anchors, for example) and ignored:

ExtensionDescription
x-ctf-metadataThe challenge metadata
x-ctf-vmsVirtual machines
x-ctf-network-policyNetwork policies, on services or at the top level
x-sizeSize of a named volume
x-username, x-passwordCredentials of an SSH port

Imprint