Docker Go SDK ImageBuild ignores errors












0















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



https://gist.github.com/gdanko/94aaf2770f586d0490c3c4a941544c13



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


Has anyone had this problem???










share|improve this question



























    0















    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



    https://gist.github.com/gdanko/94aaf2770f586d0490c3c4a941544c13



    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


    Has anyone had this problem???










    share|improve this question

























      0












      0








      0








      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



      https://gist.github.com/gdanko/94aaf2770f586d0490c3c4a941544c13



      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


      Has anyone had this problem???










      share|improve this question














      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



      https://gist.github.com/gdanko/94aaf2770f586d0490c3c4a941544c13



      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


      Has anyone had this problem???







      docker go sdk






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 3:25









      gdankogdanko

      71231229




      71231229
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404834%2fdocker-go-sdk-imagebuild-ignores-errors%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404834%2fdocker-go-sdk-imagebuild-ignores-errors%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Hercules Kyvelos

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud