Compose: docker-compose pull should ignore services with build statement

Created on 8 Mar 2018  路  6Comments  路  Source: docker/compose

At the moment docker-compose pull fails to pull an image with build statement. It likely, because we do not want to pull it, we want to build it. So docker-compose should probably ignore services with build statement

Most helpful comment

But @shin- what if I expect the opposite behaviour?

  • CI builds with docker-compose build (images in docker-compose.yml are built) and push all built images with docker-compose push
  • CI launches execute on server a docker-compose up --no-build (images in docker-compose.yml are pulled), since all images are already on the registry it should just pull and run them without creating them

Otherwise I'd have to copy all of my sources on target server to build from scratch instead of just running a docker-compose and pulling already created artefacts.

All 6 comments

Duplicate of #3660

this is not actually a duplicate. if both build and image are provided for a service, I expect docker-compose build to build a new image and tag it accordingly. I should not have to specify --ignore-pull-failures because there is no reason to attempt to pull an image that I have specified to be built.

3660 is referring to an image that already exists in the local cache (but is not expected to be built with the specified docker-compose.yml file).

it looks like this is a duplicate of #6464 and should be addressed in 1.24.0, but that hasn't been released to MacOS Docker Desktop yet. sorry for any confusion.

if i want to use the same docker-compose.yml for build and deployment i wanna build on jenkins via this docker-compose.yml then i want to setup up this docker-compose.yml on a server to just pull and run the images,

so indeed there is a use case for pulling an image which i defined to build, because i built this image via CI in another place and just want to run this build images with the same docker-compose.yml

image

this is my workaround to get it working like i want

i have to create the directories specified in build section (funny that i doesn't check if the dockerfile for build is there, it only checks if the directories are there, the dockerfile can be missing)

so just saying this check is idiotic, it wouldn't be able to build if the directories are there and the dockerfiles are missing, so please check also for the dockerfile or disable the check for the directories ..

But @shin- what if I expect the opposite behaviour?

  • CI builds with docker-compose build (images in docker-compose.yml are built) and push all built images with docker-compose push
  • CI launches execute on server a docker-compose up --no-build (images in docker-compose.yml are pulled), since all images are already on the registry it should just pull and run them without creating them

Otherwise I'd have to copy all of my sources on target server to build from scratch instead of just running a docker-compose and pulling already created artefacts.

Was this page helpful?
0 / 5 - 0 ratings