How Docker machines differ
Other providers run machines on infrastructure they manage. Docker machines are containers on your own host, so:- Disk is shared. One machine can fill the host’s disk and break every machine on it, and most Docker hosts can’t cap a container’s disk. Size the disk for your images plus your agents’ work.
-
Docker doesn’t stop overcommitting. Machine sizes can add up past the host’s CPU and memory. Set the pool’s
max_total_cpuandmax_total_memory_mbto fit the host, counting every pool that uses it. -
Machines can reach your network, including the host itself and the cloud metadata service. On a host that only runs Omnara machines, block both, and save the rules so they survive a reboot:
-
A process that escapes its container is root on the host. For stronger isolation, install gVisor on the host with
sudo runsc install -- --network=hostand setruntimetorunsc, or turn on Docker’s user namespace remapping. The flag lets machines under gVisor resolve domain names, and each machine still keeps its own network. - A host reboot ends its machines. Their containers don’t start again.
Set up a Docker pool
1
Turn on TLS
You need a Linux host running Docker Engine 25 or later with cgroup v2, the default on current Linux distributions. Follow Docker’s guide to protect the Docker daemon socket with TLS, and make Docker listen on port 2376 with Store the CA certificate, client certificate, and client key as an org-owned secret whose value is a JSON object. With the file names from Docker’s guide, this
tlsverify turned on. Never open the port without tlsverify: anyone who can reach an unauthenticated Docker API controls the host.Omnara creates a Docker network for every machine, and Docker’s default address pools run out at about 30 networks. Add a larger pool to /etc/docker/daemon.json, in a range your network doesn’t use:jq command prints it:2
Choose an image
Pick an image with a versioned tag that meets the custom image requirements. Omnara pulls a public image onto the host the first time a machine needs it and reuses that copy after that, so a newer image pushed under the same tag isn’t picked up.Pull private images, and large ones that take more than a couple of minutes to download, on the host yourself with
docker pull.3
Create the pool
Docker pools are off by default. Set
OMNARA_DOCKER_POOLS_ENABLED=1 on the API service. If the Docker host has a private address, also add it with the port to OMNARA_PRIVATE_ENDPOINT_CIDRS on the API, worker, and maintenance services, for example 10.0.5.21:2376. Restart the services after changing these.Machines can’t reach localhost. If OMNARA_PUBLIC_URL is on localhost, also set OMNARA_PUBLIC_API_URL on those services to the host’s IP address, for example http://10.0.5.21:8000/api/v1. This needs OMNARA_ALLOW_INSECURE_DEV_DEFAULTS=1, which compose sets by default.On the Machines page, click New pool and choose Docker. Enter the Docker API URL, the credential, image, CPU and memory, and capacity limits. To set runtime or allowed_images, or to use the API instead, call Create a pool with the fields under API fields.API fields
When you create a pool through the API, send these fields in the Create a pool request.provider_config applies to the whole pool, and default_machine_provider_options sets the options for each new machine, which project grants and agent configs can override. For example:
api_base_urlis the Docker host’s HTTPS address, the one you’d use asDOCKER_HOST=tcp://docker-host.internal:2376, written withhttps://. The server certificate must include that host name or IP address.imageis a public registry image, or any image already on the host.- CPU is in vCPU. Memory is a hard limit with no swap.
- Optional:
runtimeinprovider_configruns machines under another Docker runtime, such asrunscfor gVisor.startup_scriptindefault_machine_provider_optionsruns on each new machine before the daemon starts.allowed_imagesinprovider_configis an allowlist.