docker-image-resource icon indicating copy to clipboard operation
docker-image-resource copied to clipboard

How to use load_bases in a multi stage build. Add an example.

Open vergissberlin opened this issue 6 years ago • 1 comments

Hello!

Problem

I struggle with the documentation. There is an explanation for all the load_* arguments, but there is not an example of how they work together. So, this ticket is intended to improve the documentation.

I try to

I have a multi-stage Dockerfile, and I try to load the dependencies on the build.

Example pipeline

- name: build-multi-stage
  plan:
  - aggregate:
    - get: git-awsome-app
    - get: acme/ui
      params:
        save: true
  - put:  docker-ui
    params:
      build: awesome-app
      build_args:
        ARG DEPENDENCY_IMAGE:  acme/ui
      load_bases:
      - alpine
      - acme/ui

Example Dockerfile

My Docker file is similar to that:

ARG DEPENDENCY_IMAGE=acme/ui
FROM $DEPENDENCY_IMAGE as ui
COPY --from=ui /app/public /app/public

The problem again

That works so far because when I hijack the build task, the dependency image is shown up with docker image. But then the build stops with

pull access denied for null, repository does not exist or may require 'docker login'

Full output

waiting for docker to come up...
Login Succeeded
Loaded image ID: sha256:b4eb356ac79e52ce50c17255e032c34eb3e7a40d3ca5cda5b22720be98be698a
Loaded image ID: sha256:111f36eedc6c0b442ebc26bebd1bdbb1e339d900e727aa5dc01fa2de07742d13
Sending build context to Docker daemon  100.2MB
Step 1/9 : ARG FRONTDESK_IMAGE=registry.netresearch.de/blugento/frontdesk
Step 2/9 : ARG UI_IMAGE=registry.netresearch.de/blugento/ui
Step 3/9 : FROM $UI_IMAGE as ui
pull access denied for null, repository does not exist or may require 'docker login'

Do I need to use load_repsoitory or other steps? As I said, an example would be great. I have seen that other guys using DockerInDocker for that, but this thems to be overdosed to me.

Sincerely, André

vergissberlin avatar Sep 12 '19 11:09 vergissberlin

Hi did you manage to get it work? If not could you provide the resource config of acme/ui?

xtremerui avatar May 15 '20 02:05 xtremerui