Few people have mentioned this and the build functionality in compose seems be causing some ambiguities / issues etc... so wanted to just chuck a proposal on here to start discussion / comments. Couldn't see an existing one along these lines but apologies if there is!
Changes to how compose would operate:
docker-compose build
would be removeddocker-compose
against a compose file with a build
section(s) would result in no action and a warning that builds are deprecated in compose and to use docker build
. There would be an override flag which would allow compose to go ahead and pull / run any services in the compose file that don't have a build
section.Migration strategy:
build
sections from compose files and generate a compose.build
file with a list of equivalent docker build
commands for each relevant service
in the compose file. This is not a perfect alternative, but it's a friendly initial time-saver.docker
commands to run, compose.build would instead be a json file with instructions about how to build multiple images (see related proposal)Advantages (reasons for this proposal):
build
then run
for single images / containers with docker
, build then run for multiple / groups of images / containers for docker-compose
.Disadvantages:
docker build
only supports building one image at a time and compose is a shortcut to building a lot of images from contexts rapidly, this functionality would be lost (see _related proposals_)Related proposals:
docker
or docker-compose
tool to take a compose.build file (json?) to do a mass-build of multiple containers (to replace the implicit behaviour when a build section is included in the compose file)docker build
is extended to be able to build multiple images at once?Changes to compose workflows:
docker-compose
is run. This turns a 1-step process into a minimum 2-step process (assuming some other tool in the chain that could build multiple images)docker
with single images / containersList of related issues / PRs:
(not extensive, just from the last few pages of open Issues)
docker-compose.yml
files non-portable --build
and --no-build
options to run
analogous to up
command. 馃憥 from me...
-1
I use docker-compose build
all the time. It follows the DRY principle because I can have my image tag in one place (the docker-compose.yml file) instead of having to run docker build -t <tag>
and hope that I typed the same tag that's in my yml file.
Wow, this was certainly unpopular but no constructive responses really :p
Ping @shin- @aanand @vdemeester any opinions?
Not really sure what constructive response you're looking for other than "please don't do this"?
The advantages don't seem to be much of a win for losing a feature on which a lot of people evidently rely...
I'm actually wondering if you didn't want to create an issue named "proposal: create a new way to build images from some sort of docker-compose-build file", which would actually start a new way for building things, without removing the old ways. Going that path, you can develop and test it, while leaving the old way intact. Once you have your new, shiny and better way, the proposal to remove the "wrong" way as you are referring to here, could be considered without that much of a negative impact, as there would already be an alternative, that at that point might even already have become the accepted best practice... It will also help you find your "constructive responses", as you are building something up, instead of taking away without a real usable alternative.
@MetalArend perhaps you're right. The initial piece does include related proposals related to keeping the functionality with better abstractions and more separated responsibility. However I take the point that it may have been elucidated better by emphasizing adding then removing, rather than the other way around.
I think this suggestion failed to gain sufficient traction to move on with so I'm going to close it now.
Most helpful comment
I'm actually wondering if you didn't want to create an issue named "proposal: create a new way to build images from some sort of docker-compose-build file", which would actually start a new way for building things, without removing the old ways. Going that path, you can develop and test it, while leaving the old way intact. Once you have your new, shiny and better way, the proposal to remove the "wrong" way as you are referring to here, could be considered without that much of a negative impact, as there would already be an alternative, that at that point might even already have become the accepted best practice... It will also help you find your "constructive responses", as you are building something up, instead of taking away without a real usable alternative.