Commit Graph

167 Commits

Author SHA1 Message Date
Mehrad Dadar 5885a250bc
Merge branch 'docker:v2' into issue#9147 2022-02-24 18:03:05 +03:30
Mehrad Dadar ce1c788237 minor code cleanup
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-24 14:50:50 +03:30
Mehrad Dadar 67f7b84829 modified com.docker.compose.depends_on label to contain dependency type
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-23 21:34:34 +03:30
Ulysses Souza 8a9498c571
Merge pull request from glours/wait-and-scale-0
Wait and scale 0
2022-02-23 12:47:34 +01:00
Mehrad Dadar 7e7262bc77
Merge branch 'docker:v2' into issue#9147 2022-02-22 05:08:29 +03:30
Nicolas De Loof 981aea674d bump buildx to 0.7.1
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-02-21 14:28:22 +01:00
Guillaume Lours 64a9e4bf01
fix cyclomatic complexity of composeService.waitDependencies function
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-02-20 11:59:26 +01:00
Guillaume Lours 4be38f84df do not stop the dependencies wait process when reaching a dependency with service_started condition
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-02-20 10:28:34 +01:00
Guillaume Lours 09e0fa94b8 do not wait for dependencies with scale 0
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-02-20 10:28:34 +01:00
Vedant Koditkar cb45c6f2df Add unit tests for combinedConfigFiles logic
Signed-off-by: Vedant Koditkar <vedant.koditkar@outlook.com>
2022-02-18 16:37:35 +01:00
Vedant Koditkar 90ca37344f Update breaking test cases
Signed-off-by: Vedant Koditkar <vedant.koditkar@outlook.com>
2022-02-18 16:37:35 +01:00
Vedant Koditkar fb3f9e270f Add compose file path to ls command
docker compose ls will not include config files section in result

Signed-off-by: Vedant Koditkar <vedant.koditkar@outlook.com>
2022-02-18 16:37:35 +01:00
Nicolas De Loof fb9310caf2 use CustomLabels for composeV2 metadata and not impact service hash
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-02-17 09:05:54 +01:00
Mehrad Dadar ced9eba940 refactor: removed redundant code
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-17 07:55:11 +03:30
Ulysses Souza 2eeed8481d Fix pause/unpause by only applying to running containers
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-02-16 15:13:12 +01:00
Mehrad Dadar 65ed8cf4c2 Implemented
Signed-off-by: Mehrad Dadar <mehrad.dadar@gmail.com>
2022-02-05 10:27:52 +03:30
Laura Brehm a4836391a5 Set NetworkMode correctly according to network priorities
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-02-01 12:59:05 +00:00
Ulysses Souza bfd7428619
Merge pull request from ndeloof/down_volumes
only remove volumes set by compose file
2022-01-21 13:09:10 +01:00
Nicolas De Loof feba34e406
only remove volumes set by compose file
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-01-20 14:32:45 +01:00
Yuri Kanivetsky 37f763f009 Don't SetRawTerminal() when exec is run with -T
Signed-off-by: Yuri Kanivetsky <yuri.kanivetsky@gmail.com>
2022-01-19 09:11:35 +01:00
Nikhil Benesch ee586e7f1e Introduce ergonomic API for handling multiple container events
Signed-off-by: Nikhil Benesch <nikhil.benesch@gmail.com>
2022-01-07 21:22:57 +01:00
Nikhil Benesch 5eb314a4ca Add progress output while waiting for dependencies
This commit adds progress output while waiting for `depends_on`
conditions to resolve. The initial output looks like so:

     ⠿ Container chbench-zookeeper-1        Waiting      0s
     ⠿ Container chbench-kafka-1            Waiting      0s
     ⠿ Container chbench-one-off            Waiting      0s

Once all conditions have been resolved, the ouput looks like this:

     ⠿ Container chbench-zookeeper-1        Healthy      1.2s
     ⠿ Container chbench-kafka-1            Healthy      3.2s
     ⠿ Container chbench-schema-registry-1  Exited       4s

As shown above, `service_healthy` conditions result in a terminal status
of "Healthy" while `service_exited_successfully` conditions result in a
terminal status of "Exited".

Signed-off-by: Nikhil Benesch <nikhil.benesch@gmail.com>
2022-01-07 21:22:57 +01:00
Nikhil Benesch c5cdce0b60 Don't wait forever for unhealthy dependencies
The previous code would wait for dependencies to become healthy forever,
even if they'd become unhealthy in the meantime. I can't find an issue
report for this bug, but it was described in a comment on the PR that
introduced the `--wait` flag [0].

[0]: https://github.com/docker/compose/pull/8777#issuecomment-965643839

Signed-off-by: Nikhil Benesch <nikhil.benesch@gmail.com>
2022-01-07 19:13:43 +01:00
Tymoteusz Blazejczyk 9f06a02eb5 Moved bind mode creation to getBindMode function
Added unit tests for all uses cases.

Signed-off-by: Tymoteusz Blazejczyk <tymoteusz.blazejczyk@tymonx.com>
2022-01-03 08:04:34 +01:00
Tymoteusz Blazejczyk faaa93bf12 Added volume bind option SELinux label :z :Z
Added unsupported volume bind option SELinux label `:z` and `:Z` in v2.

It is a regression compared to v1 written in Python.

The v2 uses the compose-spec/compose-go to parse Compose YAML
specification files but there was missing support for volume bind option
SELinux label `:z` and `:Z` in parser. It is fixed in:

- https://github.com/compose-spec/compose-go/pull/213

It fixes 

References:

- https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label

Signed-off-by: Tymoteusz Blazejczyk <tymoteusz.blazejczyk@tymonx.com>
2022-01-03 08:04:34 +01:00
Lance Chen 1191023fb6 Propagate GroupAdd from ServiceConfig to HostConfig
The `group_add` key is parsed correctly from a compose file, but it is not
passed into the `ContainerCreate` API call, thus the configuration does
not take effect. This commit fixes the issue by propagating the
configuration from Docker compose's ServiceConfig to Docker container's
HostConfig.

Signed-off-by: Lance Chen <hello@lancechen.tw>
2021-12-17 15:08:14 +01:00
Ulysses Souza 7b6439997d Fix output redirection on command run
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-12-15 15:10:22 +01:00
Ulysses Souza 9e52e9fbe3
Merge pull request from ndeloof/cp_stopped
compose cp doesn't need a full project and can copy from stopped containers
2021-12-14 14:27:51 +01:00
Nicolas De Loof c5b7624d10
compose cp doesn't need a full project and can copy from stopped container
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-12-12 16:15:56 +01:00
Ulysses Souza cf7319fc6e Only kill running containers
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-12-10 08:48:38 +01:00
Nicolas De Loof 740276f550 handle "stop" event
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-12-09 13:57:52 +01:00
Ulysses Souza 40bca10250
Merge pull request from ulyssessouza/add-test-modes
Add 2 modes test mechanism
2021-12-09 11:16:37 +01:00
Ulysses Souza 8ae8d99528 Use build tags for selecting e2e test mode
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-12-09 10:52:18 +01:00
notok b47d8ea868 Remove intermediate containers when build succeeded
Intermediate containers remain even when build succeeded
when building with classic way (i.e. not with buildkit).
Remove them when build succeeded like default behavior of docker build.

Signed-off-by: notok <noto.kazufumi@gmail.com>
2021-12-08 04:18:05 +09:00
Ulysses Souza a97a73600e Add 2 modes test mechanism
This should test on plugin and standalone mode

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-12-07 10:25:50 +01:00
Nicolas De Loof 6735220557 ignore missing (swarm) overlay networks
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-12-06 14:06:34 +01:00
Kevin Roy d7d29b25bc compose images should list created containers images
Signed-off-by: Kevin Roy <kiniou@gmail.com>
2021-12-05 10:59:25 +01:00
Guillaume Lours a842522f49 use filepath instead of path to check if the dockerfile path is abolute or not
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2021-12-03 12:15:22 +01:00
Ulysses Souza bc1160de72 Turn external volume usage into a warning instead of erroring
This avoids a compatibility break since returning an error would avoid
the project to be started

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-12-02 13:11:20 +01:00
Nicolas De Loof 0d7567131a
compose logs to notify printer about container lifecycle events
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-12-02 09:18:49 +01:00
Ulysses Souza cf7b1441d9 Return an error when failing to list containers
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-11-29 10:28:45 +01:00
Mathieu Champlon 32005b0bfe
Merge pull request from ulyssessouza/test-multiargs
Add multiargs build e2e tests
2021-11-29 09:46:47 +01:00
Ulysses Souza 95c4502b81 Refactoring variable name
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-11-28 15:43:27 +01:00
Nicolas De Loof bac732837e
Don't check compose labels on external volumes
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-11-27 16:34:42 +01:00
Ulysses Souza b725c56c42 Fix links resolution
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-11-26 20:20:55 +01:00
Ulysses Souza cfcc9533b3 Add multiargs build e2e tests
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-11-25 21:22:30 +01:00
Mathieu Champlon cffdb69c5e Fix test config dir content
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2021-11-25 21:22:30 +01:00
Kyungsik Park 709190312c Fix to use Key instead of Service for graph updates
Signed-off-by: Kyungsik Park <kay.pak@naverlabs.com>
2021-11-24 08:02:50 +01:00
Nicolas De Loof 4dafeb57a5 introduce run —quiet-pull to align with up
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-11-23 19:14:12 +01:00
Albin Kerouanton 5f392258cb Don't try to start services with 0 replicas
When a service has 0 replicas to start, it don't try to create any
container. However `composeService.startService()` still gets executed.
This method checks if there's been containers created for that service
beforehand. If there's none, it returns the following error: `no
containers to start`.

This change checks if replicas == 0 and exits early from
`composeService.startService()` when that's the case.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2021-11-23 11:57:09 +01:00