compose icon indicating copy to clipboard operation
compose copied to clipboard

Unnecessary warning that flag '--parallel' is ignored when building with COMPOSE_DOCKER_CLI_BUILD=1"

Open ptrk8 opened this issue 6 years ago • 14 comments

Actual behavior

When I run the below command, I receive a warning in the shell that "Flag '--parallel' is ignored when building with COMPOSE_DOCKER_CLI_BUILD=1". However, it appears that docker-compose build is running in parallel when I'm using the --parallel flag so I'm not sure the warning message is correct or required.

$ COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.dev.yml build --parallel

WARNING: Native build is an experimental feature and could change at any time
WARNING: Flag '--parallel' is ignored when building with COMPOSE_DOCKER_CLI_BUILD=1
Building db      ...
Building server  ...
Building client  ...
Building cypress ...
Building db
Building client
Building cypress
Building server
Sending build context to Docker daemon  1.392MB

Expected behavior

No warning message about the --parallel flag should be present when used in conjunction with COMPOSE_DOCKER_CLI_BUILD=1.

Information

  • macOS Version: 10.15.6

Diagnostic logs

Docker for Mac: 2.4.0.0

ptrk8 avatar Oct 27 '20 10:10 ptrk8

Same issue.

Docker version 20.10.4

on Arch Linux

bartenra avatar Mar 16 '21 14:03 bartenra

On macOS, the latest Docker Desktop pushed Compose up to 1.28.5.

I found it confusing that docker-compose build --help still lists --parallel, but then if you use it:

WARNING: Flag '--parallel' is ignored when building with COMPOSE_DOCKER_CLI_BUILD=1

That indicated to me that somehow this COMPOSE_DOCKER_CLI_BUILD environment variable I had never heard of had gotten set, but echo $COMPOSE_DOCKER_CLI_BUILD yielded nothing. It wasn't until digging through release notes that I realized that the default had changed and this is implicitly set to 1 now. I wouldn't be surprised if others are confused by this.

Also, if by default --parallel does not work, how do you build images in parallel with the default set up? It wasn't clear to me if it was being built in parallel by default, or if this option is gone with the new default build process. The old parallel builds are immensely faster when you reach 3-4 images that need to be built.

johnthagen avatar Mar 16 '21 23:03 johnthagen

Starting docker compose v1.28.0 release, the cli command is used by default, so COMPOSE_DOCKER_CLI_BUILD=1.

According to the release notes, https://docs.docker.com/compose/release-notes/#1280

Set the COMPOSE_DOCKER_CLI_BUILD=0 environment variable to disable this feature.

I tried COMPOSE_DOCKER_CLI_BUILD=0 docker-compose build --parallel and that worked for me.

Then I added export COMPOSE_DOCKER_CLI_BUILD=0 to my .zshrc and now I can run docker-compose build --parallel again without the warning.

mtham8 avatar Mar 26 '21 22:03 mtham8

From testing I was doing (Docker Compose 1.28.5/macOS), it does seem like --parallel does have an effect still in the default situation, even though the warning says that the it's being ignored. If I have a Compose project with multiple services, if I don't set --parallel only one image is built at a time. If I do set --parallel, it builds them in parallel with the warning.

Some official response here would be helpful.

johnthagen avatar Mar 31 '21 14:03 johnthagen

+1 on OSX/Big Sur and docker-compose version 1.29.1, build c34c88b2 I get the warning but --parallel is still used it's clearly visible from the output (building multiple images at the same time).

vedraan avatar Jun 22 '21 15:06 vedraan

Same issue on Ubuntu 20.04.2 LTS

Docker version 20.10.7, build f0df350
docker-compose version 1.29.2, build 5becea4c

buraktabn avatar Jul 15 '21 15:07 buraktabn

This is really misleading. Moreover, without setting this flag, compose randomly chooses to build either one by one or in parallel on windows

StashOfCode avatar Aug 15 '21 19:08 StashOfCode

It appears as though docker-compose is all but frozen and the effort is being put into it's replacement:compose-cli

johnthagen avatar Aug 15 '21 20:08 johnthagen

This PR seems to indicate that Compose v1 indeed will be deprecated soon: https://github.com/docker/compose/pull/8589

johnthagen avatar Sep 18 '21 15:09 johnthagen

--parallel was indeed introduced to get the "classic" builder build service images concurrently. The introduction of buildkit, which is now used by default by docker-compose build (until explicitly disabled by COMPOSE_DOCKER_CLI_BUILD=0) makes this obsolete, as buildkit builds are BY DESIGN parallel. Pain point is that this relies on executing the docker CLI in the background (so the environment variable name).

Compose V2 also uses buildkit, being fully integrated in the Docker CLI.

ndeloof avatar Sep 20 '21 09:09 ndeloof

Maybe I haven't had enough coffee this morning, but I'm confused.

$env:COMPOSE_DOCKER_CLI_BUILD=1
$env:DOCKER_BUILDKIT=1
docker-compose build

This is DEFINITELY not building in parallel.

Is it because I'm using docker-compose instead of docker compose ?

PS C:\src> docker-compose version
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020
PS C:\src> docker compose version
Docker Compose version v2.0.0-beta.6

DaleyKD avatar Oct 08 '21 13:10 DaleyKD

Yep in my testing docker compose v2 docker compose (no hyphen) defaulted to parallel build. Install with these instructions.

xanderdunn avatar Apr 22 '22 00:04 xanderdunn

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 30 '22 16:10 stale[bot]

This issue has been automatically closed because it had not recent activity during the stale period.

stale[bot] avatar Nov 12 '22 18:11 stale[bot]