Commit Graph

228 Commits

Author SHA1 Message Date
Matt Armand bd8e57447a Add remove-orphans functionality to run, because it recommends that in error messages
Signed-off-by: Matt Armand <marmand68@gmail.com>
2023-01-11 10:31:56 -05:00
Nicolas De Loof cc912c625d introduce --remove-orphans in compose create command
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-11 07:16:50 +01:00
Guillaume Lours f6f29a4438
Merge pull request #10133 from ndeloof/build_concurrency
limit build concurrency according to --parallel
2023-01-05 09:57:13 +01:00
Nicolas De Loof aa5cdf2bf9 add support for COMPOSE_PARALLEL_LIMIT (parity with Compose v1)
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-04 12:42:49 +01:00
Nicolas De Loof d5e4f00644 introduce --no-attach to ignore some service output
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-03 18:43:40 +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
Laura Brehm a224780795 Set `pullChanged` when setting `--pull` on `compose up`
Add e2e tests

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-12-30 13:56:06 +01:00
Ákos Takács ffce33ec11 Fix empty file when using compose config in case of smaller source files
"docker compose config --output out.yml" resulted an empty file
when the generated output was smaller than 4097 bytes.
bufio.Writer doesn't seem necessary since only one write operation will happen.
This way there is no need for a new bufio.Writer that could be flushed.

Thanks for @thaJeztah for the idea of using os.WriteFile

Issue https://github.com/docker/compose/issues/10121

Signed-off-by: Ákos Takács <takacs.akos@it-sziget.hu>
2022-12-30 13:51:36 +01:00
Nicolas De Loof 9bd9f1765c check service names based on project, not running containers
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-21 21:11:44 +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
Tiger Wang 89ef8198f3 update projectOptions to be public by renaming it to ProjectOptions
Signed-off-by: Tiger Wang <tigerwang@outlook.com>
2022-12-20 08:53:27 +01:00
Guillaume Lours 0fedddb008
Merge pull request #10083 from ndeloof/nodeps
use recently introduced `withSelectedServicesOnly` to reduce code duplication
2022-12-15 15:51:29 +01:00
Nicolas De Loof 84984864c8 load project from explicit --files when set
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-15 15:38:41 +01:00
Nicolas De Loof 8566daa96e use recently introduced `withSelectedServicesOnly` to reduce code duplication
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-15 15:38:18 +01:00
Nicolas De Loof 84ea395d5d introduce --timestamp option on compose up
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-15 12:14:22 +01:00
Gabriel Féron 1cb5536a2e Address review comments
Signed-off-by: Gabriel Féron <g@leirbag.net>
2022-12-15 11:42:14 +01:00
Gabriel Féron e4850d9c48 Add --include-deps to push command
Signed-off-by: Gabriel Féron <g@leirbag.net>
2022-12-15 11:42:14 +01:00
Nicolas De Loof 8c39b5b7fd align `--format` flag and UX with docker cli
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-14 22:53:43 +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 d4a4dcf4ee resolve --env-file as absolute path
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-14 09:43:32 +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 804d7163a7 detect required service are gone to stop watching
explicit API to stop the log printer

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-07 21:07:27 +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
Guillaume Lours 7cf5940f4a
Merge pull request #10035 from ndeloof/9323
use StringToBool to detect COMPOSE_IGNORE_ORPHANS
2022-12-01 10:06:21 +01:00
Nicolas De Loof 7369127650
use StringToBool to detect COMPOSE_IGNORE_ORPHANS
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-01 09:38:57 +01:00
windforce17 2e7644ff21 use api.Separator to print right image names
Signed-off-by: windforce17 <wzcboss@qq.com>
2022-12-01 09:20:09 +01: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
Guillaume Lours 24ec0b2d09 pass services list to projectOrName function to add profiles for targeted services
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-30 13:21:16 +01:00
Nicolas De Loof c3e5e49957 configure buildx for plain output if --ansi=never has been set
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-11-24 16:02:04 +01:00
Laura Brehm 88c3aaf1bf
Merge pull request #10007 from laurazard/add-build-run
Add `--build` to `compose run`
2022-11-17 20:00:57 +01:00
Laura Brehm 35d31cc500
Add `--build` option to `compose run`
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-11-17 00:57:35 +01:00
Guillaume Lours c53539e1cc
Merge pull request #9906 from glours/profiles-priority
use COMPOSE_PROFILES value only if no command line arg profiles used
2022-11-15 18:03:11 +01:00
Guillaume Lours 32f29b833f add --no-consistency flag to convert command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-15 10:31:59 +01:00
Guillaume Lours 533fc61634 use COMPOSE_PROFILES value only if no command line arg profiles used
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-15 10:13:17 +01:00
Sebastiaan van Stijn 34e945a598
ci: remove uses of deprecated gotest.tools v2 (#9935)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 14:07:41 -05: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
Ulysses Souza 140dc519d3
cli: add shell completion function (#9269)
Integrates PR #9462 with additional fixes/changes.

Additional changes will be required to utilize this.

Co-authored-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-09-26 13:21:45 -04:00
Milas Bowman a95cc4074a
Remove support for `DOCKER_HOST` in `.env` files (#9871)
Revert "Merge pull request #9817 from ulyssessouza/apply-newly-loaded-envvars"

This reverts commit 126cb988c6, reversing
changes made to b80222fb07.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-09-26 09:26:01 -04: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
Lucas Berg 7a8d157871
convert: do not escape $ into $$ when using the --no-interpolate option (#9703)
Signed-off-by: Lucas Berg <root.lucasberg@gmail.com>
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
Co-authored-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-09-08 16:25:23 -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
Ulysses Souza 79af3cdd85 Apply newly loaded envvars to "DockerCli" and "APIClient"
Re-evaluate DockerCli and APIClient after reading the environment file.
I can contain DOCKER_HOST and/or DOCKER_CONTEXT so the DockerCli passed by docker/cli has to be re-evaluated.
Also checks for DOCKER_CERT_PATH and DOCKER_TLS_VERIFY.

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-09-08 18:23:18 +02:00
Guillaume Lours 537f023a3b fix panic when using 'compose up --build'
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-09-02 15:44:55 +02:00
Guillaume Lours 8b1b70833e add support of platforms in build section
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-09-02 15:44:55 +02:00
Milas Bowman f3e0c386d2
Revert "Apply newly loaded envvars to `DockerCli` and `APIClient`" (#9792)
Revert "Merge pull request #9745 from ulyssessouza/apply-newly-loaded-envvars"

This reverts commit 6fe34c45ca, reversing
changes made to 10cfd551e3.

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-08-26 16:03:45 -04: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 6fe34c45ca
Merge pull request #9745 from ulyssessouza/apply-newly-loaded-envvars
Apply newly loaded envvars to "DockerCli" and "APIClient"
2022-08-18 22:49:21 +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