Skip to main content

CV-B006: Deprecated version field

Warning Best Practice

Why This Matters

The top-level "version" field was used in Docker Compose V1 to specify the Compose file format version. Docker Compose V2 no longer requires or uses this field. It is silently ignored. Keeping it adds confusion and suggests the file targets an older format.

How to Fix

Remove the top-level version field entirely

Before (incorrect)

version: "3.8"
services:
  web:
    image: nginx

After (correct)

services:
  web:
    image: nginx

Rule Details

Rule Code
CV-B006
Severity
Warning
Category
Best Practice

Related Rules