Closed gvenzl closed 4 months ago
When reverting back to buildah version 1.29.1
this behavior is not observed:
[gvenzl@localhost test]$ buildah -v
buildah version 1.29.1 (image-spec 1.0.2-dev, runtime-spec 1.0.2-dev)
[gvenzl@localhost test]$ buildah bud -t test -f Dockerfile1
STEP 1/2: FROM alpine
Resolved "alpine" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob 4abcf2066143 done
Copying config 05455a0888 done
Writing manifest to image destination
Storing signatures
STEP 2/2: RUN touch test.txt
COMMIT test
Getting image source signatures
Copying blob d4fc045c9e3a skipped: already exists
Copying blob d6b63ca61d9b done
Copying config 213d71eeb1 done
Writing manifest to image destination
Storing signatures
--> 213d71eeb1e
Successfully tagged localhost/test:latest
213d71eeb1e1844103cdda0f63f5289468f39d4ab8a317aab6ff185a6df50999
[gvenzl@localhost test]$ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/test latest 213d71eeb1e1 2 seconds ago 7.67 MB
[gvenzl@localhost tests]$ buildah bud -t test1 -f Dockerfile2 --build-arg BASE_IMAGE=test
[1/2] STEP 1/1: FROM test AS base
--> 213d71eeb1e
[2/2] STEP 1/2: FROM 213d71eeb1e1844103cdda0f63f5289468f39d4ab8a317aab6ff185a6df50999 AS test1
[2/2] STEP 2/2: RUN touch foo.bar.txt
[2/2] COMMIT test1
Getting image source signatures
Copying blob d4fc045c9e3a skipped: already exists
Copying blob d6b63ca61d9b skipped: already exists
Copying blob 1dfaf2eb0548 done
Copying config 770cace6fd done
Writing manifest to image destination
Storing signatures
--> 770cace6fdc
Successfully tagged localhost/test1:latest
770cace6fdcc1b97a4c3cec452b13b315ae3d70bb207606cfddaa3f411165b64
[gvenzl@localhost tests]$ podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/test1 latest 770cace6fdcc 9 seconds ago 7.68 MB
localhost/test latest 213d71eeb1e1 32 seconds ago 7.67 MB
I am not seeing this behavior and am using a much newer version of buildah.
$ podman rmi alpine --force
Untagged: docker.io/library/alpine:latest
$ podman images | grep alpine
$ buildah build -t test -f /tmp/Dockerfile1
STEP 1/2: FROM alpine
Resolved "alpine" as an alias (/home/dwalsh/.cache/containers/short-name-aliases.conf)
Trying to pull docker.io/library/alpine:latest...
Getting image source signatures
Copying blob 4abcf2066143 skipped: already exists
Copying config 05455a0888 done |
Writing manifest to image destination
STEP 2/2: RUN touch test.txt
COMMIT test
Getting image source signatures
Copying blob d4fc045c9e3a skipped: already exists
Copying blob b9b732c9f9f9 done |
Copying config 8c1455b738 done |
Writing manifest to image destination
--> 8c1455b73894
Successfully tagged localhost/test:latest
8c1455b73894b6fd3bc9a39ca7dd9748b5d097db2943599f77c569142a7605d4
$ podman images | grep alpine
docker.io/library/alpine latest 05455a08881e 3 months ago 7.38 MB
$ buildah -v
buildah version 1.35.3 (image-spec 1.1.0, runtime-spec 1.1.0)
Description
I ran into a strange issue with
buildah
after updating, where it automatically removed the based image that is used for a build of a child image. The base image remains visible until the very last steps and gets removed during theCOMMIT
phase of the child image. For years, I was able to build an image with multiple layers, then build a child image using multi-stage builds from the base image, providing the benefits that the first layers between the base and child image remained the same, hence didn't need to be downloaded. I updated bybuildah
yesterday and now, when executing the very same build,buildah
removes the base image after the successful build of the child image.Steps to reproduce the issue:
Consider this Dockerfile called
Dockerfile1
:Then build it via
buildah bud -t test -f Dockerfile1
:This results in the following image:
Consider this Dockerfile called
Dockerfile2
:(The
FROM ${BASE_IMAGE} as base
is there to parameterize the input base image.)And build it via
buildah bud -t test1 -f Dockerfile2 --build-arg BASE_IMAGE=test --log-level trace
:test
with idd818df13c42c
has disappeared:Describe the results you received: The base image
test
with idd818df13c42c
has been removed or is no longer visible.Describe the results you expected: The base image
test
with idd818df13c42c
should remain untouched.Output of
rpm -q buildah
orapt list buildah
:Output of
buildah version
:Output of
podman version
if reporting apodman build
issue:*Output of `cat /etc/release`:**
Output of
uname -a
:Output of
cat /etc/containers/storage.conf
: