Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker compose "--no-build was passed"

When I try to docker-compose up with one of my images missing, I get:

Service 'server' needs to be built, but --no-build was passed.

I understand from the documentation that this is indeed what the --no-build option does:

--no-build Don't build an image, even if it's missing

Why is this default behavior and how can my docker-compose up automatically trigger a docker-compose build beforehand?

like image 694
Marc Perrin-Pelletier Avatar asked Oct 19 '25 04:10

Marc Perrin-Pelletier


1 Answers

This is monitored by issue 1679: "docker-compose up assumes --no-build"

The crux of the problem is:

if my image exists (because I ran docker-compose build before), but the referred Dockefile changes, up won't trigger an automatic rebuild?
It may be a misunderstanding, but I thought that up always rebuilds the image if the Dockerfile is out of sync with the image, unless --no-build is passed.

aanand adds:

up only checks that the image exists, not that it's up-to-date.
There's actually no way to check that.

We've discussed alternative approaches, including always building and never building.

like image 195
VonC Avatar answered Oct 21 '25 22:10

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!