Skip to content

.dockerignore whitelist rules not respected #2576

@AndiDog

Description

@AndiDog

Expected behavior

Skaffold calls docker build directly so that .dockerignore file is applied as expected, including whitelist rules like

**

!/.gitmodules
!/CMakeLists.txt
!/etc/**
!/CPlusPlusCode/**
!/submodules/**

which is the recommended approach – only sync what belongs to the build to avoid rebuilds.

Actual behavior

In the above .dockerignore example, only

.gitmodules
CMakeLists.txt
Dockerfile

get transmitted in the Docker context. Far from expectation.

Information

  • Skaffold version: 0.34.1
  • Operating system: macOS
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1beta13
kind: Config

build:
  artifacts:
    - image: skaffold-dockerignore-issue
      docker: {}

  tagPolicy:
    gitCommit:
      variant: AbbrevCommitSha

Steps to reproduce the behavior

See full example project at: https://github.com/AndiDog/skaffold-dockerignore-issue

Why this is important

Because builds are different in Skaffold vs. raw Docker CLI, and the good-practice whitelisting approach in .dockerignore is fully unusable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    build/dockerhelp wantedWe would love to have this done, but don't have the bandwidth, need help from contributorskind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions