From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- ...ompose%2Fcli-command-compatibility%2Findex.html | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 devdocs/docker/compose%2Fcli-command-compatibility%2Findex.html (limited to 'devdocs/docker/compose%2Fcli-command-compatibility%2Findex.html') diff --git a/devdocs/docker/compose%2Fcli-command-compatibility%2Findex.html b/devdocs/docker/compose%2Fcli-command-compatibility%2Findex.html new file mode 100644 index 00000000..202dd1a9 --- /dev/null +++ b/devdocs/docker/compose%2Fcli-command-compatibility%2Findex.html @@ -0,0 +1,37 @@ +

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 GitHub repository, so we can prioritize it.

Commands or flags not yet implemented

The following commands have not been implemented yet, and may be implemented at a later time. Let us know if these commands are a higher priority for your use cases.

compose build --memory: This option is not yet supported by buildkit. The flag is currently supported, but is hidden to avoid breaking existing Compose usage. It does not have any effect.

Flags that will not be implemented

The list below includes the flags that we are not planning to support in Compose in the Docker CLI, either because they are already deprecated in docker-compose, or because they are not relevant for Compose in the Docker CLI.

Global flags:

Config command

The config command is intended to show the configuration used by Docker Compose 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 by Docker Compose to run the project.

New commands introduced in Compose v2

Copy

The cp command is intended to copy files or folders between service containers and the local filesystem.
This command is a bidirectional command, we can copy from or to the service containers.

Copy a file from a service container to the local filesystem:

$ docker compose cp my-service:~/path/to/myfile ~/local/path/to/copied/file
+

We can also copy from the local filesystem to all the running containers of a service:

$ docker compose cp --all ~/local/path/to/source/file my-service:~/path/to/copied/file
+

List

The ls command is intended to list the Compose projects. By default, the command only lists the running projects, we can use flags to display the stopped projects, to filter by conditions and change the output to json format for example.

$ docker compose ls --all --format json
+[{"Name":"dockergithubio","Status":"exited(1)","ConfigFiles":"/path/to/docker.github.io/docker-compose.yml"}]
+

Use --project-name with Compose commands

With the GA version of Compose, you can run some commands:

When a compose project has been loaded once, we can just use the -p or --project-name to reference it:

$ docker compose -p my-loaded-project restart my-service
+

This option works with the start, stop, restart and down commands.

+

documentation, docs, docker, compose, containers

+
+

+ © 2019 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
+ https://docs.docker.com/compose/cli-command-compatibility/ +

+
-- cgit v1.2.3