You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Next, I wanted to add integration with docker compose watch, so I added develop sections like below:
The first service rebuilds the image if dependencies are changed.
Second and third service sync application code
Unfortunately, if my services with the application do not have a build section, the files are not synchronized without any error message, if I add the build section, everything starts working, but this causes docker compose build to build the same image multiple times after executing docker compose build.
From what I understand from the source code this is not the expected behavior. The sync action should work without a build section. The rebuild action requires a build section.
each of your service should be fully defined, even those share a common image. To avoid copy-pasting the build definition you can use extends or rely on yaml anchors to get the same build section applied to other services
Description
Hello,
My docker-compose file consists of one image, but it is used by multiple services. So I defined three services:
I found this trick on Stackoverflow:
https://stackoverflow.com/questions/40899236/how-to-prevent-docker-compose-building-the-same-image-multiple-times
Next, I wanted to add integration with
docker compose watch
, so I addeddevelop
sections like below:Unfortunately, if my services with the application do not have a build section, the files are not synchronized without any error message, if I add the build section, everything starts working, but this causes docker compose build to build the same image multiple times after executing
docker compose build
.From what I understand from the source code this is not the expected behavior. The
sync
action should work without abuild
section. Therebuild
action requires abuild
section.compose/pkg/compose/watch.go
Lines 337 to 339 in 11c7a25
Steps To Reproduce
I have a simple application as below:
Now I run my environment:
And then I run Compose Watch
I have the following output:
As you can see, one service is not tracked.
In a separate terminal, I check if synchronization is working.
Then I make a change in the source code:
Next I checked again:
Here's the full log.
I will add that if a change is made in dependencies (
requirements.txt
), the image is correctly updated.Compose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: