Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker build squash #897

Open
fabiosanger opened this issue Feb 27, 2023 · 1 comment
Open

Docker build squash #897

fabiosanger opened this issue Feb 27, 2023 · 1 comment

Comments

@fabiosanger
Copy link

fabiosanger commented Feb 27, 2023

I would like to enable squash during build, but none of the workarounds available seem to do the trick, below is the current build and dockerfile, with following error

"Step #1 - "build": "--squash" is only supported on a Docker daemon with experimental features enabled"

#syntax=docker/dockerfile:1.5.2
FROM jupyter/r-notebook:ubuntu-20.04
steps:
  - id: 'pull-experimental'
    name: 'gcr.io/cloud-builders/docker'
    args: [ 'pull', 'docker/dockerfile:1.5.2' ]
    env:
      - DOCKER_BUILDKIT=1
    # build the container image
  - id: 'build'
    waitFor: ['pull-experimental']
    name: 'gcr.io/cloud-builders/docker'
    entrypoint: 'bash'
    args:
      ['-c', 'docker build --squash --memory-swap=-1 -t eu.gcr.io/$PROJECT_ID/${_IMAGE_TAG} -f ${_IMAGE_NAME}/Dockerfile .']
    env:
      - DOCKER_BUILDKIT=1
@matthewrobertson
Copy link
Member

The image you are pulling your pull-experimental is not being used in your build step. If you are trying to use it as the builder, you would need to set it as the step name:

  - id: 'build'
    waitFor: ['pull-experimental']
    name: docker/dockerfile:1.5.2'
    # ...

By the way, if you are only trying to flatten the jupyter/r-notebook:ubuntu-20.04 and copy it into your own AR repo, it might be easier to use Crane flatten

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants