External Services

Update a service's resource limits (memory, CPU caps).

Changed on

Persists the new caps to the encrypted config AND live-applies them via Docker's update API. Memory and CPU can be hot-changed without a restart on running containers; stopped containers also accept the update and pick up the new caps on next start.

Pass null (or omit) any field to leave it unlimited. A request where every field is null removes any existing limits.

The response includes a per-container applied[] list so the caller can tell which members got the update and which were skipped (e.g., container not yet created, or docker update rejected because the new memory cap is below current usage).

patch/external-services/{id}/resources

Request

  • Base URL
    /api (relative, and the document was published on a file host, not at the API’s origin)
  • Auth
    none declared

Path parameters

idinteger required

External service ID

Request body

cpu_sharesinteger nullable

Relative CPU weight (default 1024). Only used when nano_cpus is None.

memory_mbinteger nullable

Hard memory limit in MiB. None = unlimited.

memory_swap_mbinteger nullable

Memory + swap limit in MiB. None = unlimited. MUST be >= memory_mb when both are set; Docker rejects the request otherwise. Set equal to memory_mb to disable swap entirely.

nano_cpusinteger nullable

CPU quota in nano-cpus. 1_000_000_000 = 1 full CPU core. None = unlimited.

shm_size_mbinteger nullable

Shared memory (/dev/shm) size in MiB. None = Docker default (64 MiB). Maps to HostConfig.shm_size (bytes). PostgreSQL uses /dev/shm for parallel query workers and large work_mem; the 64 MiB default causes "could not resize shared memory segment ... No space left on device" under load. NOTE: shm_size is fixed at container-create time — Docker's live update API cannot change it, so changing this value recreates the container.

Response

Updated resource limits

shm_not_appliedstring nullable

Set when a new /dev/shm size was saved but could not be applied, because that needs a new container and replacing it was refused or failed (the reason says which, and that no data was changed).

Changes

    • info

      added the optional property shm_not_applied to the response with the status

    • info

      added the new optional request property shm_size_mb

    • info

      added the optional property limits/shm_size_mb to the response with the status