compose: docker-compose build --pull fails on local image
It is impossible to run a docker-compose build
that will use locally built images and pull updated remote image at the same time.
build --pull
will fail on local image.
$ docker-compose build --pull app
Step 1/6 : FROM local-image as local
ERROR: Service 'app' failed to build: pull access denied for local-image, repository does
not exist or may require 'docker login'
build
without --pull
won’t fetch latest version of other base images.
Context information (for bug reports)
Output of docker-compose version
# docker-compose version
docker-compose version 1.23.1, build b02f130
docker-py version: 3.7.2
CPython version: 2.7.15
OpenSSL version: LibreSSL 2.6.5
Adding --ignore-pull-failures
to docker-compose build --pull
should be enough to fix the issue. Otherwise a separate builder script is needed to implement the logic without docker-compose
.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 18
this is still an issue. docker-compose is going to the repo instead of using the local image on my workstation
This should be re-opened. It’s definitely still problematic and frustrating. My compose has a mix of images w/ local and remote base and this makes it difficult to get the latest for remote parents.
I hit this issue today. I have a
docker-compose.yml
file like this:I use the
solution
service to build all my code once. Then, I use the resultinglighthouse-solution
image as a dependency and a base image in many other service dockerfiles. We never push thelighthouse-solution
image to our Docker registry as it is only used for building the other images.When building with
docker-compose build --pull
, we are getting the issue described here:I resolved this problem by building my own PowerShell pull and build script:
I know I am using only the
BUILD_IMAGE
,BASE_IMAGE
, andASSETS_IMAGE
build arguments for base images in mydocker-compose.yml
file. I also know I am not using hardcoded base images in mydockerfile
files. This allows me to avoid loading thedockerfile
files as the Python solution shared in this thread.I hope this helps others facing the same issue.
Thanks @jflheureux that helped me a lot and got me started on a similar one for us to run as a prior CI build step. In my case it was Dockerfiles, so I have my script find the files, rip out the dependencies and good to go. Will share in case my version is useful for folks too.
same here, would welcome having
--ignore-pull-failures