Home Explore Blog CI



docker

2nd chunk of `content/manuals/compose/releases/migrate.md`
aaa70b15084a36985384f550567e4ddf386fd40fa039afca00000001000009e7
As this option must be specified for every Compose v2 command run, it's recommended that you only use this as a temporary measure while transitioning to Compose v2.

### Command-line flags and subcommands

Compose v2 supports almost all Compose V1 flags and subcommands, so in most cases, it can be used as a drop-in replacement in scripts.

#### Unsupported in v2

The following were deprecated in Compose v1 and aren't supported in Compose v2:
* `docker-compose scale`. Use `docker compose up --scale` instead.
* `docker-compose rm --all`

#### Different in v2

The following behave differently between Compose v1 and v2:

|                         | Compose v1                                                       | Compose v2                                                                    |
|-------------------------|------------------------------------------------------------------|-------------------------------------------------------------------------------|
| `--compatibility`       | Deprecated. Migrates YAML fields based on legacy schema version. | Uses `_` as word separator for container names instead of `-` to match v1.    |
| `ps --filter KEY-VALUE` | Undocumented. Allows filtering by arbitrary service properties.  | Only allows filtering by specific properties, e.g. `--filter=status=running`. |

### Environment variables

Environment variable behavior in Compose v1 wasn't formally documented and behaved inconsistently in some edge cases.

For Compose v2, the [Environment variables](/manuals/compose/how-tos/environment-variables/_index.md) section covers both [precedence](/manuals/compose/how-tos/environment-variables/envvars-precedence.md) as well as [`.env` file interpolation](/manuals/compose/how-tos/environment-variables/variable-interpolation.md) and includes many examples covering tricky situations such as escaping nested quotes.

Check if:
- Your project uses multiple levels of environment variable overrides, for example `.env` file and `--env` CLI flags.
- Any `.env` file values have escape sequences or nested quotes.
- Any `.env` file values contain literal `$` signs in them. This is common with PHP projects.
- Any variable values use advanced expansion syntax, for example `${VAR:?error}`.

> [!TIP]
>
> Run `docker compose config` on the project to preview the configuration after Compose v2 has performed interpolation to
verify that values appear as expected.
>
> Maintaining backwards compatibility with Compose v1 is typically achievable by ensuring that literal values (no

Title: Compose v2: Command-line Flags, Environment Variables, and Configuration
Summary
Compose v2 supports most v1 flags and subcommands, but `docker-compose scale` and `docker-compose rm --all` are unsupported. The `--compatibility` flag in v2 only affects container name separators, while `ps --filter` has limited filtering options. Environment variable behavior is better documented in v2, with clear precedence rules and interpolation methods. Users should check their projects for complex variable overrides, escape sequences, literal `$` signs, and advanced expansion syntax. The `docker compose config` command helps preview the configuration after interpolation.