Milas Bowman
7aaea283ca
watch: data race / segfault fixes
...
Was getting segfaults with multiple services using
`x-develop` and `watch` at the same time. Turns out
the Moby path matcher lazily initializes the regex
pattern internally the first time it's used, so it's
not goroutine-safe.
Change here is to not use a global instance for the
ephemeral path matcher, but a per-watcher instance.
Additionally, the data race detector caught a couple
other issues that were easy enough to fix:
* Use the lock that's used elsewhere for convergence
before manipulating
* Eliminate concurrent map access when triggering
rebuilds
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2023-03-22 18:05:56 -04:00
Luis Rascao
bfeb1dc277
Fix concurrent map read/write when recreating containers
...
Signed-off-by: Luis Rascao <luis.rascao@gmail.com>
2023-03-19 21:56:06 +01:00
Nicolas De Loof
256ec49974
exclude unstable labels from config hash
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-13 17:02:28 +01:00
Nicolas De Loof
52478f0c6e
wait on service containers as dependencies to be deterministic
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-07 16:36:45 +01:00
Nicolas De Loof
b5f0a4eefa
use containers we expect to start for wait condition
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-07 16:36:45 +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
Nicolas De Loof
1640f155e9
initial support for `sync`
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-02-02 14:59:30 +01:00
Tom Collingwood
f2088bb917
fix typo
...
Signed-off-by: Tom Collingwood <tomcollingwood@yahoo.co.uk>
2023-01-11 19:07:29 +00:00
Nicolas De Loof
b8bbdcd872
detect dependency failed to start
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-19 16:26:39 +01:00
Guillaume Lours
1e682a40ac
Merge pull request #10099 from laurazard/use-defaultplatform-create
...
Use `DOCKER_DEFAULT_PLATFORM` to determine platform when creating container
2022-12-19 14:17:49 +01:00
Laura Brehm
7bc27d441b
Use `DOCKER_DEFAULT_PLATFORM` to determine platform when creating container
...
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2022-12-19 11:58:03 +00:00
Nicolas De Loof
3ee2ab87bb
ContainerStart must run sequentially for engine to assing distinct ports within configured range
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-12-12 16:08:50 +01:00
i-ky
c74a77e895
Make use of Containers.filter() and isService()
...
Signed-off-by: i-ky <gl.ivanovsky@gmail.com>
2022-12-02 12:16:35 +01:00
i-ky
7f975fa40b
Fix replacing "service:x" with "container:y"
...
Signed-off-by: i-ky <gl.ivanovsky@gmail.com>
2022-12-02 12:16:35 +01:00
Guillaume Lours
02818ba6c7
Merge pull request #9998 from glours/display-engine-warnings
...
display creation warnings from the engine
2022-11-21 15:17:26 +01:00
Nicolas De Loof
19d6ca9c5d
ignore error parsing container number label, just warn
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-11-17 15:18:28 +01:00
Guillaume Lours
a077e8a24b
display creation warnings from the engine
...
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-11-15 18:12:14 +01:00
Guillaume Lours
3bf29d401c
bump docker dependencies version
...
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
2022-10-18 16:26:54 +02:00
Nick Sieger
09e6b0292a
up/start/run: don't wait for disabled service
...
Signed-off-by: Nick Sieger <nick@nicksieger.com>
2022-08-17 12:32:10 -05:00
Jeremiah Millay
8d84a12333
Fix LinkLocalIPs in V2
...
Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
2022-07-29 21:19:34 +02:00
Guillaume Lours
150fd4b8cf
use '-' as separator by default for image name
...
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
2022-07-29 18:55:22 +02:00
Ulysses Souza
96cbb1cbcf
Add "style" tag to gocritic
...
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2022-07-13 19:33:06 +02:00
Nicolas De Loof
005fc25823
add support for setting secret from env variable
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-06-15 17:06:48 +02:00
Nicolas De Loof
85a4d04096
recreate container after image has been rebuilt/pulled
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-10 11:02:48 +01:00
Nicolas De Loof
f86f252a66
composeService to use dockerCli's In/Out/Err streams
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-03-03 16:34:57 +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
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
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
Ulysses Souza
95c4502b81
Refactoring variable name
...
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-11-28 15:43:27 +01:00
Ulysses Souza
b725c56c42
Fix links resolution
...
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-11-26 20:20:55 +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
Pierre-Antoine Guillaume
9c01e41adf
Fix typo in --wait option mechanism
...
Signed-off-by: Pierre-Antoine Guillaume <pierreantoine.guillaume@gmail.com>
2021-11-05 21:42:50 +01:00
Nicolas De Loof
72e4519cbf
introduce up --wait condition
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-11-03 18:22:29 +01:00
Ulysses Souza
c2dd40c161
Fix network_mode "service:x"
...
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
2021-10-14 10:40:44 +02:00
Nicolas De Loof
07b5512a68
`run` must attach to stdin
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-09-27 17:42:37 +02:00
Nicolas De Loof
99e75639d6
define compose container names with a valid hostname
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-09-22 19:06:34 +02:00
Nicolas De Loof
a2947457b9
get scale from deploy.replicas. Require scale normalization
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-09-15 14:02:01 +02:00
Nicolas De Loof
e71c833d79
set name from project config when recreating container
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-09-13 10:53:42 +02:00
Nicolas De Loof
bd22aed868
fix panic on scale down
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-09-03 16:14:31 +02:00
Nicolas De Loof
1ae9b3cb5d
move compose-cli code into docker/compose/v2
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-08-31 19:09:19 +02:00
JD Lloret
c82dd55fd2
allow for 0 scale/replicas
...
Signed-off-by: JD Lloret <jd.lloret@joyent.com>
2021-07-23 11:38:20 -04:00
Nicolas De Loof
0a5b43d1e3
report error when there's no container to start
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-07-12 12:10:50 +02:00
Mathieu Champlon
2d0d3881ac
Fix slice access
...
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2021-07-07 12:57:13 +02:00
Mathieu Champlon
9317ffc0ab
Serialize access to observed state
...
This should fix concurrent accesses to the map.
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2021-07-07 12:25:32 +02:00
Mathieu Champlon
918fe00f3e
Fix loop variable captures in goroutines
...
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2021-07-07 12:25:22 +02:00
Nicolas De Loof
c901edd65d
introduce `convergence` to hold per-service Containers and prevent race conditions
...
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-06-25 13:18:00 +02:00