cache-from in buildkit returns invalid character error
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- docker, go
- Domain
- build-system, devops
Research direction
Start by reproducing the two Docker builds with the shown Dockerfile, especially the second command using --cache-from=base:latest. Then trace BuildKit's cache-from handling after image metadata is loaded. Done means the invalid-character failure is explained and corrected or the expected behavior is documented with a regression test.
Written by the indexing model from the issue text.
Description
Hi!
I found strange behavior in this scenario.
I have python script (main.py):
print("Hello, World!")
Some requirements.txt:
python-dateutil==2.8.1
and Dockerfile:
# syntax=docker/dockerfile:1
FROM python:3-slim as base
RUN --mount=type=bind,target=./requirements.txt,src=./requirements.txt \
--mount=type=cache,mode=0755,target=/root/.cache/pip \
pip install -r requirements.txt
FROM base as main
COPY . /app
CMD ["python", "/app/main.py"]
I build first version with command and everything works fine:
docker build -t base --target base --build-arg BUILDKIT_INLINE_CACHE=1 .
After that I want to release a new version and reuse cache:
python-dateutil==2.8.2
docker build -t base --target base --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from=base:latest .
And I get this output:
[+] Building 1.2s (5/5) FINISHED
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 340B 0.0s
=> resolve image config for docker.io/docker/dockerfile:1 0.5s
=> CACHED docker-image://docker.io/docker/dockerfile:1@sha256:d2d74ff22a0e47b21f4bbde337e2ac4cd0a02a2226ef79264878db3dc7e87df8 0.0s
=> => resolve docker.io/docker/dockerfile:1@sha256:d2d74ff22a0e47b21f4bbde337e2ac4cd0a02a2226ef79264878db3dc7e87df8 0.0s
=> [internal] load metadata for docker.io/library/python:3-slim 0.5s
invalid character 'c' looking for beginning of value
With --progress=plain it looks like this:
#5 [internal] load metadata for docker.io/library/python:3-slim
#5 sha256:1d53a8326d1210addccb4bc5ed043a5dc9dc3d4d221b85e1b898fd379832ee7b
#5 DONE 1.3s
invalid character 'c' looking for beginning of value
Is it correct behavior? Or I didn't understand BuildKit caching system?
- Dominant language
- Go
- Stars
- 10.3k
- Forks
- 1.5k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 48
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from moby/buildkit
-
status/triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
area/dockerfile
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100