Commit Graph

246 Commits

Author SHA1 Message Date
Guillaume Tardif c9028f9f37
Merge pull request #1180 from docker/add-compose-stop
Add start and stop commands
2021-01-29 12:15:24 +01:00
Nicolas De loof c3443410fe
Merge pull request #1190 from docker/recreate_flags
introduce --force-recreate and --no-recreate
2021-01-29 11:25:11 +01:00
Ulysses Souza cd233ceb5c Add defensive code
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-01-28 13:28:53 -03:00
Nicolas De Loof 9e77499c2a
introduce --force-recreate and --no-recreate
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-01-28 15:25:41 +01:00
Ulysses Souza 4ff20bdda8 Add start and stop commands
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-01-27 17:18:10 -03:00
Guillaume Tardif 6a03c4ff03 Fixing linter after rebasing
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-26 18:20:00 +01:00
Guillaume Tardif 3f474143ad
Merge pull request #1163 from docker/stop-on-ctrlc
Stop project on Ctrl+C
2021-01-26 17:08:32 +01:00
Nicolas De Loof f33eff5903
introduce `--filter` option on `compose ls`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-01-22 10:27:56 +01:00
Dominik Braun effc126237
Make `--file` and `--project-name` global compose options
Signed-off-by: Dominik Braun <mail@dominikbraun.io>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-01-20 14:40:08 +01:00
Ulysses Souza 0529415fa7 Stop project on Ctrl+C
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-01-20 10:02:59 -03:00
Guillaume Tardif 6859413a5d Moving last things from /tests, removing dead code
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-19 15:48:48 +01:00
Guillaume Tardif 46935b0300 Move tests to each backend folder
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-19 15:25:26 +01:00
Nicolas De loof c881e22ab8
Merge pull request #1143 from aiordache/local_volume_override 2021-01-18 21:20:34 +01:00
aiordache 774234750d Parse volumes_from
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-01-18 11:06:09 +01:00
Nicolas De Loof e4682a0565
run "down" using project if it was set for command
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-01-18 10:43:52 +01:00
Guillaume Tardif 2a8c24e4ff Move config => api/config
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-15 16:55:10 +01:00
Guillaume Tardif f1ac6d4fdc Move errdefs => api/errdefs
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-15 16:54:18 +01:00
Guillaume Tardif 930ae8bdb2 goimports -local github.com/docker/compose-cli -w . ; gofmt -s -w .
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-15 16:24:00 +01:00
Guillaume Tardif 801e747adb Move context/cloud => api/cloud
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-15 16:23:53 +01:00
Guillaume Tardif 4dee783aba Move progress => api
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-15 15:57:24 +01:00
Guillaume Tardif 6a8b344885 Move backend => api
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-15 15:44:42 +01:00
aiordache 747d2de397 cleanup
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-01-14 13:20:35 +01:00
aiordache 515f3ba1e7 Revisit volume implementation
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-01-14 12:35:04 +01:00
Guillaume Tardif 8ab3149f45 Network names and volume names don’t need anymore to be re-adapted (and prefixed with project name) after loaded from compose-go
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-14 10:07:29 +01:00
Guillaume Tardif 7dd3a5a1eb Remove duplicate compute of image name & add unit test
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-13 17:30:01 +01:00
Nicolas De Loof 609eeb0962
We actually support volume labels and driver_opts
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-01-13 10:15:57 +01:00
Nicolas De loof 947009d772
Merge pull request #1113 from docker/local_inline_secrets 2021-01-11 10:31:32 +01:00
aiordache 30d6e1b9e2 override inherited secret mounts
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-01-08 16:33:30 +01:00
aiordache ebeef45e85 Implement secrets via bind-mounts for local compose
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-01-08 11:29:14 +01:00
Guillaume Tardif 7a6712afdb Do not inspect for double container name at creation time, this has already been checked, let moby error bubble up if there is a name clash at this stage
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-08 10:59:58 +01:00
Ulysses Souza 0021b14de8 Add unit tests to container_name
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-01-08 10:05:53 +01:00
Ulysses Souza b3993230d1 Add network alias to container name
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-01-07 17:06:40 -03:00
Ulysses Souza b264e1814b Add warning on container_name and scale > 1
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-01-07 17:06:40 -03:00
Ulysses Souza 8976a20698 Use `container_name` property on service
This applies `container_name` when available in
the service definition.

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-01-07 17:06:40 -03:00
Nicolas De loof 1cf48318a4
Merge pull request #1106 from docker/orphans
introduce --remove-orphans option
2021-01-07 10:16:43 +01:00
aiordache 31e40176da Add GPU support via DeviceRequests
Signed-off-by: aiordache <anca.iordache@docker.com>
2021-01-07 10:00:19 +01:00
Nicolas De Loof 4de01936f8
introduce --remove-orphans option
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-01-06 14:36:59 +01:00
Guillaume Tardif 0a5328748a When running compose down, remove containers with Force=true in case some container is still up for any reason (happened in some E2E test once)
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2021-01-06 10:07:40 +01:00
Guillaume Tardif df4fed266b
Merge pull request #1095 from docker/push_pull
ignore services without image attribute
2021-01-05 19:13:13 +01:00
Nicolas De Loof 5a455e47c3
ignore services without image attribute
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-01-05 09:47:29 +01:00
Ulysses Souza cef7a2d4ce Refactor ProjectName
This separate project name and service name for command `run`

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-01-04 14:11:54 +00:00
Guillaume Tardif 3714ab7d41 Attaching container logs
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 10:01:08 +01:00
Guillaume Tardif db73c928f3 Ensure image exist for run service
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 10:01:08 +01:00
Guillaume Tardif dc211b178a Fixed race when down with multiple containers for one service
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 10:01:08 +01:00
Guillaume Tardif 32d5644937 Pass reader Writer as options to backend, remove hardcoded os.Stdout
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 10:01:06 +01:00
Guillaume Tardif bad0d41d90 Auto-remove using container config
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 10:00:19 +01:00
Guillaume Tardif d2cfffafb4 Attach to container using compose attach
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 10:00:19 +01:00
Guillaume Tardif 76f36a69c6 Reusing existing Create() and Start() API
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 10:00:18 +01:00
Guillaume Tardif 27dc2e5be1 Reuse Create(Project) and Start(Project)
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 09:59:02 +01:00
Guillaume Tardif 8eb9733914 No need to support service `container_name` in this PR, will do separately, minor cleanup
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 09:59:02 +01:00
Guillaume Tardif d127cac6d4 Ensure images exist before starting progress display for network / volumes, otherwise progress display is all mixed up
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 09:59:02 +01:00
Guillaume Tardif 7bed2343e6 Remove not implemented options
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 09:59:02 +01:00
Guillaume Tardif b289138ca9 No need to filter services again in backend, filter is done by cli command. Added e2e test, labels one-off and slug
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-18 09:59:02 +01:00
aiordache 412385c495 Add `compose run` command
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-12-18 09:58:55 +01:00
Nicolas De Loof e2c55c2122
e2e test for local `Log` command
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-17 11:48:58 +01:00
Nicolas De Loof eda6a59379
introduce options struct in the API
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-17 11:10:57 +01:00
Nicolas De Loof 855a879a6a
Introduce `removeOrphans` to cleanup injected AWS simulation container
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-17 10:46:17 +01:00
Nicolas De Loof 056dfb95bc
allow to collect logs for a subset of project services
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-17 10:32:46 +01:00
Chris Crone 65561c085a deps: Bump docker and buildx vendoring
Signed-off-by: Chris Crone <christopher.crone@docker.com>
2020-12-16 10:57:42 +01:00
Chris Crone 87153b9d25 local.compose.build: Ensure images are exported
If a user has BUILDX_NO_DEFAULT_LOAD=1 set, then the images will
not be stored in the image store unless we explicitly say that they
must be.

Signed-off-by: Chris Crone <christopher.crone@docker.com>
2020-12-11 11:08:49 +01:00
Chris Crone ddaec1a367 compose.build: Wait for progress writer after build
Signed-off-by: Chris Crone <christopher.crone@docker.com>
2020-12-11 10:40:09 +01:00
Chris Crone 6e76aadfd6 deps: Bump buildx and docker vendoring
Signed-off-by: Chris Crone <christopher.crone@docker.com>
2020-12-11 10:40:09 +01:00
Djordje Lukic 72cec58ed1 Check if stdin is nil before closing
getContainerStreams returns a nil stdin if the container is already running

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2020-12-11 10:08:27 +01:00
Guillaume Tardif cf378834e5 No rebuild on compose up if image already exists by default, added first use of compose pull_policy and `compose up --build` to allow to force rebuild.
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-10 18:38:16 +01:00
Nicolas De Loof 446008a4b6
on ACI container ID is `project_service` and name is `service`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-09 14:39:10 +01:00
Nicolas De Loof 1f5a77e67c
move test to command-specific test file
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-09 10:33:52 +01:00
Nicolas De Loof 1d859dc807
`Ps` return ContainerSummary, not Services
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-09 10:33:51 +01:00
Guillaume Tardif e4ed2b02d7 Fix container attaching to wrong volume name for compose non-external volumes. Took the opportunity to validate R/O volumes, but not related to this fix
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-08 18:48:18 +01:00
Djordje Lukic 033941d890 compose: Add service labels
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2020-12-08 16:32:30 +01:00
Nicolas De Loof 1eb40999e2
Split compose.go into command-focussed go files
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-08 11:58:49 +01:00
Djordje Lukic f6c4c4e590 Move compose e2e tests to own folder
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2020-12-08 11:30:25 +01:00
Guillaume Tardif 8ee2286126
Merge pull request #1021 from gtardif/fix_down_no_containers
Ensure down continues (removes networks) even if containers have been removed already
2020-12-07 17:33:26 +01:00
Guillaume Tardif b987f2eaf8
Merge pull request #1023 from docker/fix-build-target
Pass the target to buildkit
2020-12-07 17:31:20 +01:00
Guillaume Tardif d0728d94f2 Fix compose volume creation and check this in volume e2e test
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-07 16:57:55 +01:00
Djordje Lukic 7d88fc61d3 Pass the target to buildkit
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2020-12-07 16:47:58 +01:00
Guillaume Tardif fe363fd146 Fix compose volume creation and check this in volume e2e test
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-07 16:42:43 +01:00
Guillaume Tardif 2657f5804e Ensure down continues (removes networks) even if containers have been removed already. Avoid returning nil error and nil project in `projectFromContainerLabels`
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-07 15:48:57 +01:00
Nicolas De loof 576aa46d21
Merge pull request #1015 from docker/logConsumer
Revisit logs/up API to pass a LogConsumer vs io.Writer
2020-12-07 14:57:43 +01:00
Nicolas De Loof ca123e08eb
Revisit logs/up API to pass a LogConsumer vs io.Writer
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-07 14:47:44 +01:00
Guillaume Tardif fea0cf8c82 Fix linter
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-07 14:46:31 +01:00
Guillaume Tardif 6fc8eefb1b Remove build flag for local backend
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-07 14:41:27 +01:00
Guillaume Tardif ec5afcfd4d `compose up` and other compose commands running on “Moby” context type.
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-07 14:41:27 +01:00
Nicolas De Loof 26fe75a7e3
Remove stopped containers on `down`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-07 11:39:21 +01:00
Guillaume Tardif ff1808644c Remove flakyness in compose e2e test : can’t count networks as we have several compose stacks start in //
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-07 09:31:32 +01:00
Guillaume Tardif d0b840bcd1 Fix compose up build when no image name in compose file.
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-04 18:19:34 +01:00
Guillaume Tardif aacd881358 Add -d flag in e2e tests now that `docker compose up` attaches to logs by default
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-04 15:19:12 +01:00
Guillaume Tardif 0b2eaede8c Adding unit test for bind mount creation
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-04 13:49:43 +01:00
Guillaume Tardif 814536c0bd Fixing bind mount with relative path when specifying relative working dir. Added first local compose volume e2e test
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-04 13:49:43 +01:00
Djordje Lukic fcddb77b48 Give progress its own context
The build and progress can't share the same context, the progress context
needs to live longer for the progress to be able to read all the messages
from build.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2020-12-04 13:05:26 +01:00
Nicolas De loof 6830ca1919
Merge pull request #1006 from gtardif/compose_fix_down_deps
Fix service initial status in graph, in order to fix compose down duplicate removal of container
2020-12-04 11:03:42 +01:00
Nicolas De Loof 136d09e1ac
split `Up` into `Create`+`Start` so logs don't collide with progress
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-04 08:16:50 +01:00
Nicolas De Loof 39e4107e12
attach to log stream by default on `up`
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2020-12-03 16:51:00 +01:00
Djordje Lukic 2f09b634cc Implement `docker compose pull`
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2020-12-03 16:14:38 +01:00
Guillaume Tardif 56511a4a3a renaming
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-03 15:47:19 +01:00
Guillaume Tardif 44b4bc01af In `compose down` progress display: prefix container names with “Container”, same as Services, Networks, homogeneous with `compose up`
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-03 15:46:37 +01:00
Guillaume Tardif 9d918a8ceb Fix service initial status in graph, in order to fix compose down duplicate removal of container (example : awesome-compose ELK stack)
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-03 15:27:35 +01:00
Guillaume Tardif e469b40e28 Remove duplicate ensureImagesExist()
Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
2020-12-02 13:51:56 +01:00
Ulysses Souza 7e4cfc0e3b Add order to down command
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2020-12-02 13:51:11 +01:00
Guillaume Tardif 4270f383a7
Merge pull request #988 from docker/feat-platform
Add platform when running containers
2020-12-02 13:24:07 +01:00
Guillaume Tardif 91083bc42c
Merge pull request #1001 from gtardif/compose_build_img_name
If compose file has a build section and no image name, build image with the right derived image tag
2020-12-02 13:16:03 +01:00