12

When one runs docker-compose up --build then the docker images are created sequential. Is it possible to build these images concurrently using docker-compose?

There are multiple issues including this, but it is unclear whether it is possible or not.

2 Answers 2

10

Yes, it's possible. You can use --parallel option since docker-composer 1.23.2 version.

Version 1.23.2 also correct 1.23.0 bug:

Reverted a 1.23.0 change that appended random strings to container names created by docker-compose up, causing addressability issues. Note: Containers created by docker-compose run will continue to use randomly generated names to avoid collisions during parallel runs.

https://github.com/docker/compose/releases/tag/1.23.2

You can use it simply doing:

docker-compose build --parallel
1
  • In addition, we can set container_name to skip the "random name of the containers" problem. To get more information, check this link out.
    – M. Rostami
    Aug 28, 2020 at 6:07
3

Currently it is not possible to make concurrent builds with Docker Compose.

There are issues about that but the latest tests indicate that concurrent builds take actually longer than the sequential ones.

The issue seems to be related to the storage drivers.
You can track this issue to get updates: https://github.com/moby/moby/issues/9656

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.