diff --git a/compose/cli-command-compatibility.md b/compose/cli-command-compatibility.md index 877a06f929..5842b8e879 100644 --- a/compose/cli-command-compatibility.md +++ b/compose/cli-command-compatibility.md @@ -6,7 +6,8 @@ title: Compose command compatibility with docker-compose The `compose` command in the Docker CLI supports most of the `docker-compose` commands and flags. It is expected to be a drop-in replacement for `docker-compose`. -If you see any Compose functionality that is not available in the `compose` command, create an issue in the [Compose](https://github.com/docker/compose/issues){:target="_blank" rel="noopener" class="_"} GitHub repository so we can prioritize it. +If you see any Compose functionality that is not available in the `compose` command, create an issue in the [Compose](https://github.com/docker/compose/issues){:target="_blank" rel="noopener" +class="_"} GitHub repository, so we can prioritize it. ## Commands or flags not yet implemented @@ -26,4 +27,39 @@ either because they are already deprecated in `docker-compose`, or because they Global flags: -* `compose --compatibility` Deprecated in docker-compose. +* `--compatibility` has been resignified Docker Compose V2. This now means that in the command running V2 will behave as V1 used to do. + * One difference is in the word separator on container names. V1 used to use `_` as separator while V2 uses `-` to keep the names more hostname friendly. So when using `--compatibility` Docker + Compose should use `_` again. Just make sure to stick to one of them otherwise Docker Compose will not be able to recognize the container as an instance of the service. + +## Config command + +The config command is intented to show the configuration used by Docker Commpose to run the actual project. +As we know, at some parts of the Compose file have a short and a long format. For example, the `ports` entry. +In the example below we can see the config command expanding the `ports` section: + +docker-compose.yml: +``` +services: + web: + image: nginx + ports: + - 80:80 +``` +With `$ docker compose config` the output turns into: +``` +services: + web: + image: nginx + networks: + default: null + ports: + - mode: ingress + target: 80 + published: 80 + protocol: tcp +networks: + default: + name: workspace_default +``` + +The result above is a full size configuration of what will be used in by Docker Compose to run the project.