docker-compose up vs docker-compose up --build vs docker-compose build --no-cache

DockerDocker Compose

Docker Problem Overview


I couldn't figure out what the difference between those.

  • docker-compose up

  • docker-compose up --build

  • docker-compose build --no-cache

Is there any command for upwithout cache?

Docker Solutions


Solution 1 - Docker

The following only builds the images, does not start the containers:

  • docker-compose build

The following builds the images if the images do not exist and starts the containers:

  • docker-compose up

If you add the --build option, it is forced to build the images even when not needed:

  • docker-compose up --build

The following skips the image build process:

  • docker-compose up --no-build

If the images aren't built beforehand, it fails.

The --no-cache option disables the Docker build cache in the image creation process. This is used to cache each layer in the Dockerfile and to speed up the image creation reusing layers (~ Dockerfile lines) previously built for other images that are identical.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionToshiView Question on Stackoverflow
Solution 1 - DockerzuazoView Answer on Stackoverflow