Skip to main content

CV-S003: Unknown Service Property

Error Schema

Why This Matters

Service definitions in Docker Compose have a defined set of properties such as image, build, command, ports, volumes, environment, depends_on, healthcheck, and restart. Any property not in the compose-spec service schema is rejected. Common typos include "port" instead of "ports", "volume" instead of "volumes", and "env" instead of "environment". Extension fields starting with "x-" are allowed within services for custom metadata that Docker Compose will pass through to deploy contexts or ignore.

How to Fix

Use a valid service property name. Check the Docker Compose reference for the full list.

Before (incorrect)

services:
  web:
    image: nginx
    port:
      - "80:80"

After (correct)

services:
  web:
    image: nginx
    ports:
      - "80:80"

Rule Details

Rule Code
CV-S003
Severity
Error
Category
Schema

Related Rules