compose icon indicating copy to clipboard operation
compose copied to clipboard

"Custom build outputs" support

Open tpict opened this issue 3 years ago • 8 comments

Are there any plans to support Docker's custom build outputs, either via a flag to docker-compose build or in the Compose file? Thanks!

tpict avatar Jun 22 '22 19:06 tpict

How would docker compose up handle this, if you configure build output to write image to a local tar file, to create a container for service after a successful build ? At most, such an option could only be available for docker compose build. is this what you are asking for ? Maybe docker compose build --output type=tar,dest=some_path could generate image files as some_path/.tar`?

ndeloof avatar May 12 '23 13:05 ndeloof

created a draft PR to add support for custom build outputs, please give it a try and let me know if this covers your need https://github.com/docker/compose/pull/10642

ndeloof avatar Jun 01 '23 14:06 ndeloof

It would be extremely useful

image

Docker outputs on docker-compose doesn't show all necessary informations. In this cas, i absolutely don't know which container is "eca8ccf1c84e"

Aarbel avatar Jun 14 '23 12:06 Aarbel

@Aarbel your comment is unrelated to custom build output, feel free to open a dedicated issue (and include docker inspect eca... for diagnostic

ndeloof avatar Jun 14 '23 13:06 ndeloof

Closing as obsolete. Requested feature is unclear how this would benefit docker compose usage

ndeloof avatar Apr 19 '24 12:04 ndeloof

Here is my use case:

For Custom Build Output here, it is useful for me to take the build logs and test artifacts created during docker build and expose them back to the host so they can be uploaded into Gitlab as a CI artifact. Currently, I create these with docker build command. I would like to migrate everything to compose, but this lack of supports for outputs makes the migration impossible.

Ryanf55 avatar Apr 19 '24 13:04 Ryanf55

Hello, I was just directed to this and yes, we would really need this as well... We leverage docker compose extensively for dev, test, build and prod... We especially use a complex multi stage build.

Having docker compose helps us encapsulating what would otherwise be pretty complex docker build or run commands..

One of the stage of the build is to to create official binaries (RPM/DEB packages). We can even build multiple archs (amd64, arm64, s390x and ppc64le) thanks to the platform field...

But, sadly, custom build outputs (--output arg) is not supported by docker compose and thus we end up with a pretty complicated build command:

docker buildx build --secret id=conan_password,env=CONAN_PASSWORD --secret id=conan_login_username,env=CONAN_LOGIN_USERNAME --ssh=default --target packages --output=build/linux --platform linux/amd64 --platform linux/arm64 .

Even though all those things are also defined in the compose.yaml.

Please add the output field to the compose spec. 🙏🏻 . Thanks!

gegles avatar May 21 '24 03:05 gegles

@gegles use docker buildx bake so you don't need this long command line and can reuse declarations from your compose file

ndeloof avatar May 21 '24 07:05 ndeloof