Google Cloud Build with Docker images that are based on each other

3/7/2019

I have two or more Docker images where the latter ones are based on the first image. I want to build them all with Google Cloud Build and have the following multi-step cloudbuild.yaml:

steps:
  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '-t', 'gcr.io/$PROJECT_ID/lh-build', './src']

  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '-t', 'gcr.io/$PROJECT_ID/lhweb', './src/LHWeb']


images:
  - gcr.io/$PROJECT_ID/lh-build
  - gcr.io/$PROJECT_ID/lhweb

When I run this build config, I can see the following error:

Step 1/6 : FROM eu.gcr.io/logistikhelden/lh-build manifest for eu.gcr.io/logistikhelden/lh-build not found

I then tried to push the image after the first step:

...
  - name: 'gcr.io/cloud-builders/docker'
    args: ['push', 'gcr.io/$PROJECT_ID/lh-build']
...

The same problem remains, though. Any idea whats wrong here?

-- Steven
docker
google-cloud-build
google-kubernetes-engine

1 Answer

3/23/2019

You are pushing the image to gcr.io, but it looks like your Dockerfile specifies a base image in the eu.gcr.io registry. Try changing your Dockerfile base image to FROM gcr.io/logistikhelden/lh-build.

-- codrienne
Source: StackOverflow