I'm really not understanding `docker-compose build`

I use docker-compose pull and then docker-compose up. I use this with the -f flag to specify a .yml config file which defines the network and ports etc. That works. However it’s incredibly slow, even on the best hardware (Apple Macbook Pro M1 with 64GB RAM).

I noticed that the build command has a --parallel flag. That sounds like it might be quicker… but how to use it? I tried docker build --parallel – no errors but also nothing discernible happened. I’ve read the docs but I’m at a complete lack of understanding as to the function of the build command. What’s it for?

Google says this: " Description. Builds, (re)creates, starts, and attaches to containers for a service. Unless they are already running, this command also starts any linked services. The docker compose up command aggregates the output of each container (like docker compose logs --follow does)."

… which tells me precisely nothing that I can understand.

Me: what does the build command do
Google: It builds

… brilliant, tx Google. Crystal clear now.

Thanks
N.

It looks like this is the default behavior and the flag is allowed for backward compatibility: Build command with --parallel flag · Issue #9174 · docker/compose · GitHub

Google is not the documentation, but I could not find that description in the docs. Which is this:

Services are built once and then tagged, by default as project_service.

If the Compose file specifies an image name, the image is tagged with that name, substituting any variables beforehand. See variable interpolation.

If you change a service’s Dockerfile or the contents of its build directory, run docker compose build to rebuild it.

What you found sounds like the description of Docker Compose, not the build subcommand.

It could be because with Docker Desktop you will work in a virtual machne and the number of cpu or the memory in the VM could be less than you need.

Or you are trying to build amd64 images on ARM cpu so amd64 is just emulated.