Compose Develop Specification (original) (raw)

Develop is an optional part of the Compose Specification. It is available with Docker Compose version 2.22.0 and later.

This page defines how Compose behaves to efficiently assist you and defines the development constraints and workflows set by Compose. Only a subset of Compose file services may require a develop subsection.

The develop subsection defines configuration options that are applied by Compose to assist you during development of a service with optimized workflows.

watch

The watch attribute defines a list of rules that control automatic service updates based on local file changes. watch is a sequence, each individual item in the sequence defines a rule to be applied by Compose to monitor source code for changes. For more information, seeUse Compose Watch.

action

action defines the action to take when changes are detected. If action is set to:

exec

Requires: Docker Compose2.32.2 and later

exec is only relevant when action is set to sync+exec. Like service hooks, exec is used to define the command to be run inside the container once it has started.

ignore

The ignore attribute can be used to define a list of patterns for paths to be ignored. Any updated file that matches a pattern, or belongs to a folder that matches a pattern, won't trigger services to be re-created. The syntax is the same as .dockerignore file:

If the build context includes a .dockerignore file, the patterns in this file is loaded as implicit content for the ignores file, and values set in the Compose model are appended.

include

It is sometimes easier to select files to be watched instead of declaring those that shouldn't be watched with ignore.

The include attribute can be used to define a pattern, or a list of patterns, for paths to be considered for watching. Only files that match these patterns will be considered when applying a watch rule. The syntax is the same as ignore.

path

path attribute defines the path to source code (relative to the project directory) to monitor for changes. Updates to any file inside the path, which doesn't match any ignore rule, triggers the configured action.

target

target attribute only applies when action is configured for sync. Files within path that have changes are synchronized with the container's filesystem, so that the latter is always running with up-to-date content.