From 678c1b90f4c1b445551234537d4f8cc88dfeba1f Mon Sep 17 00:00:00 2001 From: Guillaume Lours <705411+glours@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:59:26 +0200 Subject: [PATCH] move watch from alpha to main command Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com> --- cmd/compose/alpha.go | 1 - cmd/compose/compose.go | 1 + docs/reference/compose.md | 59 ++++++++++++------------ docs/reference/compose_watch.md | 16 +++++++ docs/reference/docker_compose.yaml | 2 + docs/reference/docker_compose_alpha.yaml | 2 - docs/reference/docker_compose_watch.yaml | 47 +++++++++++++++++++ pkg/e2e/watch_test.go | 2 +- 8 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 docs/reference/compose_watch.md create mode 100644 docs/reference/docker_compose_watch.yaml diff --git a/cmd/compose/alpha.go b/cmd/compose/alpha.go index 3e4c41bb692..64a2c910f68 100644 --- a/cmd/compose/alpha.go +++ b/cmd/compose/alpha.go @@ -31,7 +31,6 @@ func alphaCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) }, } cmd.AddCommand( - watchCommand(p, dockerCli, backend), vizCommand(p, dockerCli, backend), publishCommand(p, dockerCli, backend), ) diff --git a/cmd/compose/compose.go b/cmd/compose/compose.go index cd6155ad298..383440da631 100644 --- a/cmd/compose/compose.go +++ b/cmd/compose/compose.go @@ -477,6 +477,7 @@ func RootCommand(dockerCli command.Cli, backend api.Service) *cobra.Command { // copyCommand(&opts, dockerCli, backend), waitCommand(&opts, dockerCli, backend), scaleCommand(&opts, dockerCli, backend), + watchCommand(&opts, dockerCli, backend), alphaCommand(&opts, dockerCli, backend), ) diff --git a/docs/reference/compose.md b/docs/reference/compose.md index 643b03654ee..2d8a4b4194f 100644 --- a/docs/reference/compose.md +++ b/docs/reference/compose.md @@ -5,35 +5,36 @@ Define and run multi-container applications with Docker. ### Subcommands -| Name | Description | -|:--------------------------------|:------------------------------------------------------------------------| -| [`build`](compose_build.md) | Build or rebuild services | -| [`config`](compose_config.md) | Parse, resolve and render compose file in canonical format | -| [`cp`](compose_cp.md) | Copy files/folders between a service container and the local filesystem | -| [`create`](compose_create.md) | Creates containers for a service. | -| [`down`](compose_down.md) | Stop and remove containers, networks | -| [`events`](compose_events.md) | Receive real time events from containers. | -| [`exec`](compose_exec.md) | Execute a command in a running container. | -| [`images`](compose_images.md) | List images used by the created containers | -| [`kill`](compose_kill.md) | Force stop service containers. | -| [`logs`](compose_logs.md) | View output from containers | -| [`ls`](compose_ls.md) | List running compose projects | -| [`pause`](compose_pause.md) | Pause services | -| [`port`](compose_port.md) | Print the public port for a port binding. | -| [`ps`](compose_ps.md) | List containers | -| [`pull`](compose_pull.md) | Pull service images | -| [`push`](compose_push.md) | Push service images | -| [`restart`](compose_restart.md) | Restart service containers | -| [`rm`](compose_rm.md) | Removes stopped service containers | -| [`run`](compose_run.md) | Run a one-off command on a service. | -| [`scale`](compose_scale.md) | Scale services | -| [`start`](compose_start.md) | Start services | -| [`stop`](compose_stop.md) | Stop services | -| [`top`](compose_top.md) | Display the running processes | -| [`unpause`](compose_unpause.md) | Unpause services | -| [`up`](compose_up.md) | Create and start containers | -| [`version`](compose_version.md) | Show the Docker Compose version information | -| [`wait`](compose_wait.md) | Block until the first service container stops | +| Name | Description | +|:--------------------------------|:-----------------------------------------------------------------------------------------------------| +| [`build`](compose_build.md) | Build or rebuild services | +| [`config`](compose_config.md) | Parse, resolve and render compose file in canonical format | +| [`cp`](compose_cp.md) | Copy files/folders between a service container and the local filesystem | +| [`create`](compose_create.md) | Creates containers for a service. | +| [`down`](compose_down.md) | Stop and remove containers, networks | +| [`events`](compose_events.md) | Receive real time events from containers. | +| [`exec`](compose_exec.md) | Execute a command in a running container. | +| [`images`](compose_images.md) | List images used by the created containers | +| [`kill`](compose_kill.md) | Force stop service containers. | +| [`logs`](compose_logs.md) | View output from containers | +| [`ls`](compose_ls.md) | List running compose projects | +| [`pause`](compose_pause.md) | Pause services | +| [`port`](compose_port.md) | Print the public port for a port binding. | +| [`ps`](compose_ps.md) | List containers | +| [`pull`](compose_pull.md) | Pull service images | +| [`push`](compose_push.md) | Push service images | +| [`restart`](compose_restart.md) | Restart service containers | +| [`rm`](compose_rm.md) | Removes stopped service containers | +| [`run`](compose_run.md) | Run a one-off command on a service. | +| [`scale`](compose_scale.md) | Scale services | +| [`start`](compose_start.md) | Start services | +| [`stop`](compose_stop.md) | Stop services | +| [`top`](compose_top.md) | Display the running processes | +| [`unpause`](compose_unpause.md) | Unpause services | +| [`up`](compose_up.md) | Create and start containers | +| [`version`](compose_version.md) | Show the Docker Compose version information | +| [`wait`](compose_wait.md) | Block until the first service container stops | +| [`watch`](compose_watch.md) | EXPERIMENTAL - Watch build context for service and rebuild/refresh containers when files are updated | ### Options diff --git a/docs/reference/compose_watch.md b/docs/reference/compose_watch.md new file mode 100644 index 00000000000..788c63484a7 --- /dev/null +++ b/docs/reference/compose_watch.md @@ -0,0 +1,16 @@ +# docker compose watch + + +EXPERIMENTAL - Watch build context for service and rebuild/refresh containers when files are updated + +### Options + +| Name | Type | Default | Description | +|:------------|:-----|:--------|:----------------------------------------------| +| `--dry-run` | | | Execute command in dry run mode | +| `--no-up` | | | Do not build & start services before watching | +| `--quiet` | | | hide build output | + + + + diff --git a/docs/reference/docker_compose.yaml b/docs/reference/docker_compose.yaml index 022cf16fe78..b6f5d76c509 100644 --- a/docs/reference/docker_compose.yaml +++ b/docs/reference/docker_compose.yaml @@ -173,6 +173,7 @@ cname: - docker compose up - docker compose version - docker compose wait + - docker compose watch clink: - docker_compose_build.yaml - docker_compose_config.yaml @@ -201,6 +202,7 @@ clink: - docker_compose_up.yaml - docker_compose_version.yaml - docker_compose_wait.yaml + - docker_compose_watch.yaml options: - option: ansi value_type: string diff --git a/docs/reference/docker_compose_alpha.yaml b/docs/reference/docker_compose_alpha.yaml index 43994d80cdd..807097a387e 100644 --- a/docs/reference/docker_compose_alpha.yaml +++ b/docs/reference/docker_compose_alpha.yaml @@ -6,11 +6,9 @@ plink: docker_compose.yaml cname: - docker compose alpha publish - docker compose alpha viz - - docker compose alpha watch clink: - docker_compose_alpha_publish.yaml - docker_compose_alpha_viz.yaml - - docker_compose_alpha_watch.yaml inherited_options: - option: dry-run value_type: bool diff --git a/docs/reference/docker_compose_watch.yaml b/docs/reference/docker_compose_watch.yaml new file mode 100644 index 00000000000..532b9a956a2 --- /dev/null +++ b/docs/reference/docker_compose_watch.yaml @@ -0,0 +1,47 @@ +command: docker compose watch +short: | + EXPERIMENTAL - Watch build context for service and rebuild/refresh containers when files are updated +long: | + EXPERIMENTAL - Watch build context for service and rebuild/refresh containers when files are updated +usage: docker compose watch [SERVICE...] +pname: docker compose +plink: docker_compose.yaml +options: + - option: no-up + value_type: bool + default_value: "false" + description: Do not build & start services before watching + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: quiet + value_type: bool + default_value: "false" + description: hide build output + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false +inherited_options: + - option: dry-run + value_type: bool + default_value: "false" + description: Execute command in dry run mode + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false +deprecated: false +hidden: false +experimental: false +experimentalcli: false +kubernetes: false +swarm: false + diff --git a/pkg/e2e/watch_test.go b/pkg/e2e/watch_test.go index ab2d1c5aaf3..62a0ba7732b 100644 --- a/pkg/e2e/watch_test.go +++ b/pkg/e2e/watch_test.go @@ -89,7 +89,7 @@ func doTest(t *testing.T, svcName string, tarSync bool) { cleanup() t.Cleanup(cleanup) - cmd := cli.NewDockerComposeCmd(t, "--verbose", "alpha", "watch", svcName) + cmd := cli.NewDockerComposeCmd(t, "--verbose", "watch", svcName) // stream output since watch runs in the background cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr