#12014·coolify

[Bug]: POST /api/v1/services rejects connect_to_docker_network for docker_compose_raw services (422 "field is not allowed")

Author: niklebeCreated Sep 25, 2026Updated Sep 26, 2026
Labels🐛 Possible Bug🌐️ API

Description and Error Message

POST /api/v1/services rejects connect_to_docker_network when you create a service from docker_compose_raw. The request fails with:

422 {"message":"Validation failed.","errors":{"connect_to_docker_network":["This field is not allowed."]}}

The field is meant to be accepted on this path. The custom-compose branch of create_service lists it in its own $allowedFields and validates it as boolean (ServicesController.php#L589-L600 @ v4.3.23). But the request never gets that far. The top-level $allowedFields at the start of create_service (L362) does not include connect_to_docker_network, and the extra-fields check at L400 returns the 422 before the code branches on type vs docker_compose_raw.

PATCH /api/v1/services/{uuid} accepts the field (L1178). The only workaround is to create without it and PATCH afterwards. That needs an extra round trip, and the flag only takes effect on the next start, so the service can't be created and deployed in one step with the network attached (see #11295 / #11371 for how the flag is applied post-up).

Steps to Reproduce

  1. POST /api/v1/services with project_uuid, server_uuid, environment_name, a valid docker_compose_raw, and "connect_to_docker_network": true.
  2. Observe the 422 This field is not allowed.
  3. Repeat without the field and then PATCH it to true. That succeeds.

Example Repository URL

N/A (API only). Reproduced through the coolify-terraform/coolify provider 0.1.23, which sends the field on create.

Coolify Version

v4.3.18 (reproduced live). The code path is unchanged in v4.3.23.

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 24.04

Additional Information

Suggested fix: add connect_to_docker_network to the top-level $allowedFields in create_service (the one-click type path already forces it to true, so it's harmless there).