-
Notifications
You must be signed in to change notification settings - Fork 5.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 build and docker build lead to different IDs #7905
Comments
Copying my comment for emphasis
|
For me it does not work even without COPY. When I have Dockerfile with two commands, where the second command fails, then the first command will always be executed again. This doesn't happen with common docker. |
@knyttl Show the I'm not sure about you, but for me different IDs presumably amount to And the IDs are not content hashes:
My understanding is the changes are not caused by the files themselves, but by differences in the archives sent to From what I can see the resolution (issue) was blocked by changes in Also, next year a python package, that uses the docker client directly (whatever that means), might become publicly available. Just spreading rumors :) |
compose already supports this; set the |
Unfortunately it doesn't help in my case:
version: "3"
services:
nginx:
build:
context: .
dockerfile: docker2/Dockerfile2
target: nginx
php:
build:
context: .
dockerfile: docker2/Dockerfile2
target: php
# 30
FROM node AS assets
WORKDIR /app
COPY package.json package-lock.json ./
COPY docker2 docker2
RUN npm i
FROM node as php
FROM node as nginx
The mistery is that |
Could it be it's writing a temp file to the you can try adding the dockerfile and such temp/swap files to .dockerignore Does it make a difference if you enable buildkit? |
I tried to dockerignore it, but apparently I mistyped. Indeed by default vim creates a swap files alongside every open file ( |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still extremely relevant |
This issue has been automatically marked as not stale anymore due to the recent activity. |
still relevant |
It's Dec 2021 and we still have this error?No wonder people are abandoning the project for other container technologies. Tried with both binaries: docker and docker-compose. $ docker --version
Docker version 20.10.8, build 3967b7d
$ docker-compose --version
docker-compose version 1.29.2, build 5becea4c BASE DOCKERFILE
ONBUILD COPY pubspec.* /usr/local/bin/app/ REbuilding with docker-compose
Without --no-cache
$ docker compose build
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 37B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/supercash/flutter-web-app:latest 0.0s
=> [internal] load build context 0.3s
=> => transferring context: 375.77kB 0.3s
=> [1/1] FROM docker.io/supercash/flutter-web-app 0.0s
=> CACHED [2/1] WORKDIR /usr/local/bin/app 0.0s
=> CACHED [3/1] RUN echo "Copying the dependencies: pubspec.*" 0.0s
=> CACHED [4/1] COPY pubspec.* /usr/local/bin/app/ 0.0s
=> CANCELED [5/1] RUN flutter pub get 🐛 With
|
@marcellodesales from your description, your issue looks unrelated to this ticket, which is about differences in the build implementation between the classic (python) compose implementation and native I tried reproducing your issue, but wasn't able to (steps below), but if you have a way to reproduce the issue, which could depend on the base image or your build-context (e.g., if there's paths that use symlinks), please open a ticket in https://github.com/moby/buildkit/issues with the exact steps to reproduce the issue. create an mkdir repro-7905 && cd repro-7905
docker build -t onbuild -f- . <<'EOF'
FROM busybox
ONBUILD COPY pubspec.* /usr/local/bin/app/
EOF Create a echo "pubspec one" > pubspec.one
docker build -t foo -f- . <<'EOF'
FROM onbuild
EOF Verify the file has the expected content: docker run --rm foo cat /usr/local/bin/app/pubspec.one
pubspec one Modify the echo "pubspec one modified" > pubspec.one
docker build -t foo -f- . <<'EOF'
FROM onbuild
EOF
Verify the file has the expected content: docker run --rm foo cat /usr/local/bin/app/pubspec.one
pubspec one modified |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still relevant |
This issue has been automatically marked as not stale anymore due to the recent activity. |
sorry for the terrible delay without answer on this issue. Most of the examples shared in comments use Compose v1, with or without buildkit enabled. Compose v1 will be End of Life in a few weeks, and Compose v2 uses the same codebase as @marcellodesales As you already use |
closing as unclear and obsolete. If you encounter a comparable issue, please create a fresh new one with details on your environment |
These two issues has been closed for duplicity and then for staleness respectively.
We don't have a right to reopen it while the problem persists, so creating a new issue
The text was updated successfully, but these errors were encountered: