Commit Graph

91 Commits

Author SHA1 Message Date
Milas Bowman 37850f7955 ci: upgrade to Go 1.20.5 and Moby v24.x
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-06-07 10:41:49 -04:00
Nicolas De Loof 93bd27a0cc introduce ability to select service to be stopped by `compose down`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-05-24 17:32:32 +02:00
Guillaume Lours 2e4faf80f5 add dry-run support to up command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-05-04 15:11:11 +02:00
Guillaume Lours eca1365d42
cli: dry run support for `build` (#10502)
* add dry-run support for classic builder
* add dry-run support for buildkit

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-05-02 14:23:26 -04:00
Nicolas De Loof d01ef5887a restore support for `--memory`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-04-25 15:41:08 +02:00
Benjamín Guzmán 7840a92c40 Added tests to `viz` subcommand
Signed-off-by: Benjamín Guzmán <bg@benjaminguzman.dev>
2023-04-24 12:18:37 +02:00
Guillaume Lours 7fb87856aa add dry-run support to down command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-04-07 10:41:51 +02:00
Guillaume Lours b83edbd039 add dry-run support to create command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-30 10:25:56 +02:00
Guillaume Lours 72a61c0602 add dry-run support to run command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-27 18:57:11 +02:00
Nicolas De Loof 6c1f06e420 Run classic builder with BuildConfig, not buildx.Options
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-03-21 15:37:55 +01:00
Guillaume Lours 4434cea535 add dry-run support for push command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-08 14:23:57 +00:00
Guillaume Lours 3f7d3c2661 add dry-run support for pull command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-05 22:04:32 +01:00
Guillaume Lours 167c6a89b1 add dry-run support to restart command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-03-02 10:14:59 +01:00
Milas Bowman 762cf9d998
Merge pull request #10252 from glours/dry-run-exec-support
support dry-run for exec command
2023-02-17 10:05:31 -05:00
Nicolas De Loof 9ac0392baf introduce --timeout on `up`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-14 12:16:41 +01:00
Nicolas De Loof 9765f171cd
store exec details to offer better dry-run status on ExecStart
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-13 11:59:01 +01:00
Guillaume Lours eb1c798912 support dry-run for rm command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-02-09 17:34:10 +01:00
Guillaume Lours 78b9404767 support dry-run for stop command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-02-09 17:34:10 +01:00
Guillaume Lours 25be264ed8 support dry-run for exec command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-02-08 11:21:47 +01:00
Nicolas De Loof 0f5b5ccbd0 detect replacement container is created and inform printer so it attach and don't stop
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-06 11:23:13 +01:00
Guillaume Lours 2336d9fe35 support dry-run for cp command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-02-03 22:44:26 +01:00
Guillaume Lours f24d3458c6
Merge pull request #10217 from glours/dry-run-pause-support
Dry run pause support
2023-01-31 14:56:27 +01:00
Nicolas De Loof 41e056341b rename `convert` to `config` to align with compose v1 UX
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-30 22:23:53 +01:00
Guillaume Lours 6754c6b68a add dry-run support of pause and unpause commands
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-30 10:36:36 +01:00
Guillaume Lours 982a8ccb88 support dry-run for kill command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-30 09:27:17 +01:00
Guillaume Lours 790712fa92 update tty and plain text writers to support dry run mode
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-30 09:27:17 +01:00
maxcleme 634a7d2a7b Support for docker compose build --push when using multiple platforms
Signed-off-by: maxcleme <maxime.clement@docker.com>
2023-01-26 16:54:41 +01:00
Guillaume Lours fb36f7fffd directly embed the orignal APIClient in the DryRunClient
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Guillaume Lours 3fac506a30 identify functions which need to be ovorridden for dry run feature
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Guillaume Lours 5081ab0507 create custom CLI when dry-run mode active
update documentation

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Guillaume Lours 13ef440d6a add DryRun API Client with delagation pattern
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Guillaume Lours fbf845c5f8 add dry-run flag
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2023-01-16 11:11:35 +01:00
Nicolas De Loof bb9cf32245 introduce experimental watch command (skeletton)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-12 10:52:58 +01:00
Nicolas De Loof 8b4ac37f9c introduce `--ignore-buildable` to ignore buildable images on pull
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-03 18:43:23 +01:00
Nicolas De Loof 24f83271f2 don't assume os.Stdout and rely on dockerCLI.streams
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-20 23:52:25 +01:00
Nicolas De Loof bc568eeb9b align `compose ps` output with `docker ps`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-14 22:53:43 +01:00
Nicolas De Loof 0368f19030 distinguish stdout and stderr in `up` logs
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-13 14:42:42 +01:00
Nicolas De Loof a0acc20d88
introduce --parallel to limit concurrent engine calls
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-06 08:15:50 +01:00
Milas Bowman 053f20edab
port: improve error-handling if port not found (#10039)
This method looked slightly incomplete. If the port wasn't found,
it'd return `err`, but that was always `nil`, so we'd print out
`:0`.

Now, we construct a nice error message with the targeted port and
the ones we found.

The `--protocol` flag is also now case-insensitive to prevent any
weirdness/confusion there.

Co-authored-by: Nick Sieger <nicksieger@gmail.com>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-12-05 22:11:45 +00:00
Nicolas De Loof 9ac4f69918 move image digests resolution to backend
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-11-30 21:18:18 +01:00
Vedant Koditkar 1d4cb32001
Add support to push images quietly via compose cli
Signed-off-by: Vedant Koditkar <vedant.koditkar@outlook.com>
2022-10-11 15:19:23 -05:00
Milas Bowman b49b9ffe7e Merge remote-tracking branch 'upstream/v2' into down-image-rm 2022-09-13 18:00:41 +01:00
Milas Bowman 61845dd781
logs: filter to services from current Compose file (#9811)
* logs: filter to services from current Compose file

When using the file model, only attach to services
referenced in the active Compose file.

For example, let's say you have `compose-base.yaml`
and `compose.yaml`, where the former only has a
subset of the services but are both run as part of
the same named project.

Project based command:
```
docker compose -p myproj logs
```
This should return logs for active services based
on the project name, regardless of Compose file
state on disk.

File based command:
```
docker compose --file compose-base.yaml logs
```
This should return logs for ONLY services that are
defined in `compose-base.yaml`. Any other services
are considered 'orphaned' within the context of the
command and should be ignored.

See also #9705.

Fixes #9801.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-09-08 16:26:00 -04:00
Laura Brehm 88df5ede42
Merge pull request #9797 from laurazard/start-only-services
Only attempt to start specified services on `compose start [services]`
2022-09-08 13:00:20 -04:00
Laura Brehm 209293e449
Restrict compose project to selected services and dependencies on `compose start`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-09-08 12:31:55 -04:00
Milas Bowman bc806da712 build: label built images for reliable cleanup on `down`
When running `compose down`, the `--rmi` flag can be passed,
which currently supports two values:
 * `local`: remove any _implicitly-named_ images that Compose
            built
 * `all`  : remove any named images (locally-built or fetched
            from a remote repo)

Removing images in the `local` case can be problematic, as it's
historically been done via a fair amount of inference over the
Compose model. Additionally, when using the "project-model"
(by passing `--project-name` instead of using a Compose file),
we're even more limited: if no containers for the project are
running, there's nothing to derive state from to perform the
inference on.

As a first pass, we started labeling _containers_ with the name
of the locally-built image associated with it (if any) in #9715.
Unfortunately, this still suffers from the aforementioned problems
around using actual state (i.e. the containers might no longer
exist) and meant that when operating in file mode (the default),
things did not behave as expected: the label is not available
in the project since it only exists at runtime.

Now, with these changes, Compose will label any images it builds
with project metadata. Upon cleanup during `down`, the engine
image API is queried for related images and matched up with the
services for the project. As a fallback for images built with
prior versions of Compose, the previous approach is still taken.

See also:
 * https://github.com/docker/compose/issues/9655
 * https://github.com/docker/compose/pull/9715

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-09-07 17:57:29 -04:00
Abdullah Shahid Khan c87efed6a4
api: fix typo on Push godoc (#9798)
Signed-off-by: Abdullah Shahid Khan <69131903+Sh9hid@users.noreply.github.com>
2022-08-31 11:18:25 -04:00
Ulysses Souza 55cf579e02 Fix `down` with `--rmi`
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-08-29 19:48:23 +02:00
Laura Brehm fcfcc1524e
Apply compose model on `compose kill`, add `--remove-orphans`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-08-19 04:26:08 +02:00
Ulysses Souza 0b4cb85c84 Code formatting
Just moving it up to make clearer

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-08-18 22:41:02 +02:00