compose: Docker Compose V2 doesn't seem to allow you to stop running builds in parallel, stopping solution from building.

Description I have a docker-compose file that runs 10 .Net Microservices, after upgrading to Docker Desktop 4.3.2, Docker Engine v20.10.11, when I try to do ‘docker-compose up --build’ whilst Docker Compose v2 is enabled, the following issue happens: image

When I run ‘docker-compose disable-v2’, the issue is resolved and the builds run sequentially.

Steps to reproduce the issue:

  1. Have Docker Compose v2 enabled
  2. Have a docker-compose file with 10 .net microservices that reference Dockerfiles.
  3. Run ‘docker-compose up --build’

Describe the results you received: Build run in parallel and error: image

Describe the results you expected: Build runs in either parallel or sequential and pass.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version v2.2.1

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.7.1)
  compose: Docker Compose (Docker Inc., v2.2.1)
  scan: Docker Scan (Docker Inc., v0.14.0)

Server:
 Containers: 26
  Running: 24
  Paused: 0
  Stopped: 2
 Images: 92
 Server Version: 20.10.11
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.16.3-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 7.69GiB
 Name: docker-desktop
 ID: MLBF:5YQ2:UIR6:HHAK:XJED:UDK7:6SHN:3FW6:ENYR:PQRH:UZMU:RQ7E
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details:

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 15

Most upvoted comments

We are not able to switch from docker-compose 1 to docker-compose 2. I really wonder why the parallel build issues are not addressed at all. Using the same command to build our solution with docker-compose v2 causes our build server to crash completly cause it’s out of memory and CPU and starts to kill random processes cause of OOM. Setting buildkit to 0 causes the build to take 30 minutes instead of 15 with docker-compose v1.

I made a buildx issue 2 years ago: https://github.com/docker/buildx/issues/359

There is no flag to specify how many parallel jobs are run…there is no flag to specify memory and cpu…

Are we the only ones using docker-compose with more then just a simple TODO App?

We are also having this issue at my org. We have 9 dotnet containers that rebuild at the same time when running docker compose up --build -d and we suspect the issue is that something is getting rate-limited due to the burst of network requests to nuget.org and also to our internal registry, which requires authentication, meaning 9 auth requests are happening in a very short period of time. It could also be a network driver or some other aspect of the networking chain that is choking on the number of requests generated. When we add significantly longer timeouts (30 seconds), the problem resolves in most cases (not all). We would rather just turn off parallel builds, or be able to limit it to 2-3 at a time.

@fuzzybair good point. Added support for COMPOSE_PARALLEL_LIMIT in aa5cdf2 (#10133)

@ndeloof thanks for the quick response but as I indicated above for those of us on windows i.e. Docker Desktop that option is not exposed. see https://github.com/moby/buildkit/issues/2906#issuecomment-1154565987. In short there is no configurable buildkitd.toml file. The docker team seems to be ignoring/missing that fact, consistently stating buildkitd.toml as a solution to this issue. I checked out the code to see if I could implement a solution but there are many barriers to overcome for example when following the developer setup guide

  1. You have to reinstall docker desktop using Hyper-V or you get \\.\pipe\docker_engine_windows: the system cannot find the file specified.
  2. The base image microsoft/windowsservercore used in moby/moby/Dockerfile.windows is not a valid tag.
  3. The IDE used in the setup requires a license from JetBrains, I would think adding an option for using a well supported open source tool like Microsoft’s Visual Studio Code would be a good addition to the tool chain.

Anyway after spending a little over a day trying to get a simple build working I gave up and left my needs in the hands of those working on the project in hopes they recognize the gap in what is provided and the suggested solution.

I have a different issue but really similar to yours, when I run docker compose build all the dependencies of my services are downloaded at the same moment and some service get their dependecies, others just timeout … I don’t understand why there is not a simple flag telling “build image one after another”

docker compose v2 uses BuildKit by default, you can force use of the legacy “classic” builder setting DOCKER_BUILDKIT=0.

Can you please check you can build this Dockerfile by DOCKER_BUILDKIT=1 docker build ...? If you get the same issue, then please report issue to https://github.com/docker/buildx