Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48795

docker.build fails for Dockerfile which uses ARG in FROM

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • docker-workflow-plugin
    • None
    • Jenkins 2.99

      Plugins:
      Docker Pipeline 1.14
      Docker Commons 1.10

      Dockerfiles are allowed to have ARG directives before the FROM directive, in which case the value for FROM can reference build arguments:

      ARG TAG
      FROM alpine:$TAG

      Using docker.build('foo', '--build-arg TAG=3.7 .') in scripted pipeline on such a Dockerfile fails with:

      java.io.IOException: Cannot retrieve .Id from 'docker inspectalpine:$TAG'

          [JENKINS-48795] docker.build fails for Dockerfile which uses ARG in FROM

          Jakob Ovrum created issue -
          Jakob Ovrum made changes -
          Description Original: Dockerfiles are allowed to have ARG directives before the FROM directive, in which case the value for FROM can reference build arguments:

          ARG TAG
          FROM alpine:$TAG

          Using docker.build('foo', '--build-arg TAG=3.7') in scripted pipeline on such a Dockerfile fails with:

          Cannot retrieve .Id from 'docker inspectfoo:$TAG'
          New: Dockerfiles are allowed to have ARG directives before the FROM directive, in which case the value for FROM can reference build arguments:

          ARG TAG
           FROM alpine:$TAG

          Using docker.build('foo', '--build-arg TAG=3.7 .') in scripted pipeline on such a Dockerfile fails with:
          java.io.IOException: Cannot retrieve .Id from 'docker inspectalpine:$TAG'
          Jakob Ovrum made changes -
          Description Original: Dockerfiles are allowed to have ARG directives before the FROM directive, in which case the value for FROM can reference build arguments:

          ARG TAG
           FROM alpine:$TAG

          Using docker.build('foo', '--build-arg TAG=3.7 .') in scripted pipeline on such a Dockerfile fails with:
          java.io.IOException: Cannot retrieve .Id from 'docker inspectalpine:$TAG'
          New: Dockerfiles are allowed to have ARG directives before the FROM directive, in which case the value for FROM can reference build arguments:

          ARG TAG
           FROM alpine:$TAG

          Using docker.build('foo', '--build-arg TAG=3.7 .') in scripted pipeline on such a Dockerfile fails with:


           java.io.IOException: Cannot retrieve .Id from 'docker inspectalpine:$TAG'
          Nicolas De Loof made changes -
          Component/s New: docker-workflow-plugin [ 20625 ]
          Component/s Original: docker [ 20834 ]
          Component/s Original: docker-plugin [ 18724 ]
          Nicolas De Loof made changes -
          Assignee Original: Nicolas De Loof [ ndeloof ]

            Unassigned Unassigned
            jovrum Jakob Ovrum
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: