-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker-compose using buildkit fails to fetch local images (already existing or build by another service) #4162
Comments
For latest Docker versions that happens because you haven't pointed base image platform type like linux/amd64 for example. |
Can you post logs please? Not sure what service fails Also do you repro with docker build command?:
|
@crazy-max, @filinvadim thanks for your help. I've trying to build without docker-compose using "plain" docker with buildx: Error from running the docker build:
I'm running the build from project-root where docker-compose.yml is, which has extended the docker-compose.build.yml. I think the problem here is, which is the referencing path (or actually the build-context) that is being used? is it the build.context "." where docker-compose.build.yml is located whereas "." will be the Path of that file? Or will I have to use path relative to project-root where the build is started from? This is somehow confusing while looking on "context: ." setting in view of docker-compose.yml and build-options. I would expect that "context: {path}" is the mandatory part that tells what dockerfile will be using as reference?! is May be you can help me to deconfuse that :) I've been testing these context's in both failing with same error indicating docker doesn't know where "rootfs/" subdir is?! And please don't wonder the complicated setup. I need different versions of php-app during migration-tasks from old to new versions. I also have multiple projects and wanted to recycle the main-app-base (which has contains apache + specific php-mod version) not having to rebuild that everytime from scratch. I have multiple app-version specific docker-compose.yml which are used for extending. So I thought that would be the best way to cover that. My paths/compose setup looks as follows:
the root docker-compose.yml has the build-service using extend like this:
I also added platforms attribute to docker-compose.build.yml - is this the right way?
|
Little update regarding trying to build without docker-compose using "plain" docker with buildx: This variant seems to work. My mistake here. But I still have to demystify how to get this working using docker-compose build and which build.context path is used. I'll try now to run the same with docker-compose build (using .docker/services/httpd-php/ as context). |
While the build works manually I now discovered my initial assume was correct. The "build.context" seems to be relative to where the docker-compose.yml is located. After changing .docker/services/httpd-php/docker-compose.build.yml with context ".docker/services/httpd-php/" docker-compose build complains just before building:
|
Ok I think the build for base-image works now. Seems like the culprit is somewhere else .Having the image build "base-image" (named typo3-httpd:v12 in my case) and trying to build Dockerfile.project which should be Build command (without docker-compose):
This error occurs:
|
I think buildkit is the problem. Figured out similar problem has been already mentioned here:
buildkit isolation seems to be the problem while having two separate builds whereas one (dockerfile) depends on the other. |
Can you share the results of Using local images in builds like this will only work as expected using the |
@jedevc thanks for trying to help. Here is the info. And just to clarify. The build consists of two services. One generic build-image and a project-based build basing on the first image provided by the other service. On the host the build image of first build-service is loaded. But it's obviously missing as "FROM"-Base for the build inside buildkit. Actually I'm trying to solve that using a combination of local-registry and cache-from & cache-to. Not shure yet it works (build is actually running). But I think this hazzles should either work out of the box or be documentated better to help developers solving this. $ docker info
$ docker buildx ls
Actually I'm using this command to setup docker-buildx:
|
I'm totally lost thinking about dropping buildx and buildkit! This renders useless if even multi-stage build (same Dockerfile!!!) begin to fail like this: #7 [httpd-base internal] load metadata for docker.io/library/stage-rc:latest
|
What a shame ... at least the last problem with missing stage in same dockerfile was solved. What a shame! I had a Backslash in the last argument of a RUN statement which leads to the interpretation, that the next statement like: RUN A commentFROM ... AS stage2 |
I'm still trying to get everything working. I'm not shure this is a buildkit or a buildx issue. It's complicated to determine what component is causing the issue without being deep diving into the topic. I've made a very simple reproducer with alpine image (without real builds inside) and even this is failing like reported: And to be shure it's adressed correctly I also made an issue for buildx: If there is success on one of the tickets resolving or finding the real culprit I will report in the other ticket. |
docker-compose using buildkit fails to fetch local images (already existing or build by another service).
This bug obviously has been discussed here:
docker/compose#3660
I'm still having the issue and found this thread! I don't think disabling Buildkit is a smart hack if one wants to use buildkit-features like
COPY --chmod=a+x
The matter that buildkit obviously breaks this is a bug. Has this been reported to buildkit or is the bug located in docker itself?
example:
Update
A simple reproducer:
https://github.com/Gabriel-Kaufmann/reproducer-docker-compose-buildx-issue
The text was updated successfully, but these errors were encountered: