Skip to content

Commit

Permalink
move watch from alpha to main command
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Lours <[email protected]>
  • Loading branch information
glours committed Sep 19, 2023
1 parent a697a06 commit 678c1b9
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 33 deletions.
1 change: 0 additions & 1 deletion cmd/compose/alpha.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
1 change: 1 addition & 0 deletions cmd/compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)

Expand Down
59 changes: 30 additions & 29 deletions docs/reference/compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions docs/reference/compose_watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# docker compose watch

<!---MARKER_GEN_START-->
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 |


<!---MARKER_GEN_END-->

2 changes: 2 additions & 0 deletions docs/reference/docker_compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions docs/reference/docker_compose_alpha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 47 additions & 0 deletions docs/reference/docker_compose_watch.yaml
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion pkg/e2e/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 678c1b9

Please sign in to comment.