Rules Reference

July 24, 2025 ยท View on GitHub

DCLint categorizes rules into several categories to help you ensure that your Docker Compose files meet specific standards.

In the tables below:

  • ๐Ÿ”ด โ€” Error. Indicates a critical issue. The exit code will be non-zero if this occurs.
  • ๐ŸŸก โ€” Warning. Indicates a non-critical issue. The exit code will remain zero.
  • ๐Ÿ”ง โ€” Auto-fixable. Issues reported by this rule are automatically fixable.
  • โš™๏ธ โ€” Configurable. Behavior of the rule can be adjusted using options.

Style

These rules enforce consistency in formatting and structure to ensure that your Docker Compose files are easy to read and maintain. They focus on best practices related to code style, such as proper ordering of fields and avoiding unnecessary complexity.

NameDescription
No Quotes In VolumesValues in the volumes section should not be enclosed in quotes.๐ŸŸก ๐Ÿ”ง
Service Dependencies Alphabetical OrderServices in the depends_on section should be sorted alphabetically.๐ŸŸก ๐Ÿ”ง
Service Keys OrderKeys within each service should follow a specific order.๐ŸŸก ๐Ÿ”ง โš™๏ธ
Service Ports Alphabetical OrderThe list of ports in a service should be sorted alphabetically.๐ŸŸก ๐Ÿ”ง
Services Alphabetical OrderServices should be sorted alphabetically.๐ŸŸก ๐Ÿ”ง
Top Level Properties OrderTop-level properties should follow a specific order.๐ŸŸก ๐Ÿ”ง โš™๏ธ

Security

Security rules focus on identifying potential vulnerabilities in your Docker Compose files. These rules help prevent common security risks, such as exposing sensitive data or using unsafe configurations.

NameDescription
No Duplicate Container NamesContainer names must be unique to prevent conflicts and ensure proper container management.๐Ÿ”ด
No Duplicate Exported PortsExported ports must be unique to avoid conflicts.๐Ÿ”ด
No Unbound Port InterfacesExported ports must be bound to specific interfaces to avoid unintentional exposure.๐Ÿ”ด
Service Container Name RegexContainer names must match the pattern /^[a-zA-Z0-9][a-zA-Z0-9_.-]+$/u to comply with Docker naming conventions.๐Ÿ”ด
Service Image Require Explicit TagServices must use a specific image tag instead of "latest", "stable" or similar or no tag.๐Ÿ”ด โš™๏ธ

Best Practice

These rules enforce general Docker Compose best practices, guiding you towards configurations that are known to work well. They help avoid pitfalls and ensure your configurations are reliable and maintainable.

NameDescription
No Build And ImageEach service must use either build or image, not both.๐Ÿ”ด โš™๏ธ
No Version FieldThe version field must be absent in the configuration.๐Ÿ”ด ๐Ÿ”ง
Require Project Name FieldThe name field should be included in the configuration.๐ŸŸก
Require Quotes In PortsPorts in ports and expose sections should be enclosed in quotes.๐ŸŸก ๐Ÿ”ง โš™๏ธ

Performance

Performance rules are designed to optimize the runtime behavior of your Docker Compose setup. They identify configurations that could negatively impact performance, such as inefficient resource usage or misconfigurations that may lead to slower application performance.

NameDescription