Docker

Docker is the easiest option to implement instances, to get started, make sure you have Docker installed on the host machine.

When creating a Docker challenge, you can select a container image from the list of images available on your machine. You'll also need to write a challenge Lua script, where you're expected to call raya.setDockerOptions({}) and specify at least the container's port. When an instance is requested, a new container is launched with an ephemeral port assigned automatically.

Raya communicates with the docker daemon using the unix socket unix:///var/run/docker.sock.

If you are running Raya inside a container, make sure to have the socket mounted as a volume. Check this example

Limitations

While Docker works well for most scenarios, you might want to consider using Kubernetes if:

  • You need high availability and can't tolerate a single point of failure (The Docker implementation is limited to a single host).
  • Your challenges are resource-intensive or you have too many challenges for a single host to handle.
  • You want to assign a dynamic subdomain for each instance instead of exposing Docker's ephemeral ports.

    Subdomains can be implemented with Docker if you use a reverse proxy on the host machine and configure it dynamically via your Lua script. However, Kubernetes makes this process much more straightforward.