Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

ImageBuild is ignoring build errors #14

@donutheist

Description

@donutheist

If my Dockerfile has a COPY command where the file is missing, ImageBuild does not report the error.

Here is my Dockerfile:

FROM gcr.io/distroless/base

COPY ap1.repo /etc/yum.repos.d/ap.repo

Here is my test script

If I run the test script with the COPY command but no file, ImageBuild does not report the error and continues. Here is output.

[gdanko@SDGL141bb265b go]$ go run dockerbuild.go 
Tarring => Dockerfile
*** success ***
{0xc0002f6100 linux}

*** ImageBuild output ***
Step 1/2 : FROM gcr.io/distroless/base

But if I go into the planB directory and run docker build I will end up in error.

[gdanko@SDGL141bb265b planB]$ docker build -t planb .
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM gcr.io/distroless/base
 ---> 1358ac6604c5
Step 2/2 : COPY ap1.repo /etc/yum.repos.d/ap.repo
COPY failed: stat /var/lib/docker/tmp/docker-builder088607045/ap1.repo: no such file or directory

Now, if I touch the missing file, both the script and the manual docker build work correctly.

[gdanko@SDGL141bb265b go]$ touch planB/ap1.repo
[gdanko@SDGL141bb265b go]$ go run dockerbuild.go 
Tarring => Dockerfile
Tarring => ap1.repo
*** success ***
{0xc0002d8380 linux}

*** ImageBuild output ***
Step 1/2 : FROM gcr.io/distroless/base
---> 1358ac6604c5
Step 2/2 : COPY ap1.repo /etc/yum.repos.d/ap.repo
---> 32459dc23e01
---> 32459dc23e01
Successfully built 32459dc23e01
Successfully tagged dummy:latest

And manually

[gdanko@SDGL141bb265b go]$ cd planB
[gdanko@SDGL141bb265b planB]$ docker build -t planb .
Sending build context to Docker daemon   2.56kB
Step 1/2 : FROM gcr.io/distroless/base
---> 1358ac6604c5
Step 2/2 : COPY ap1.repo /etc/yum.repos.d/ap.repo
 ---> Using cache
 ---> 81d57edf0715
Successfully built 81d57edf0715
Successfully tagged planb:latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions