Kaniko: Kaniko doesn't support exclusions in `.dockerignore`

Created on 21 Nov 2018  路  4Comments  路  Source: GoogleContainerTools/kaniko

Actual behavior
Kaniko doesn't support exclusions in .dockerignore.

Expected behavior
Kaniko should respect exclusion patterns in .dockerignore.

To Reproduce
Steps to reproduce the behavior:

  1. Create .dockerignore with the following content:
*
!target/scala-2.12/backend.jar
  1. Kaniko (latest version) will delete all files in current context, but it should not delete target/scala-2.12/backend.jar.
kinbug

Most helpful comment

@etiennelb I'm SO sorry to hear that. I'll see if I can change the functionality so that dockerignore files are stored in memory and ignored during build time, instead of removing them at the beginning.

All 4 comments

Hi folks.

I had the same issue right now.
I have a dockerignore file with the same content :

*
!target/xxx/xxx.war

I ran kaniko with the following command, mounting my local workspace in the container :

docker container run --rm \
           -v $HOME/.docker/config.json:/root/.docker/config.json \
           -v $PWD:/workspace \
           $KANIKO_IMAGE"

Kaniko deleted all my project files.

I lost everything. Even my local git repository... :disappointed:

@etiennelb I'm SO sorry to hear that. I'll see if I can change the functionality so that dockerignore files are stored in memory and ignored during build time, instead of removing them at the beginning.

@priyawadhwa looks like maybe we can close this one and create a follow-up issue to implement .dockerignore ?

Hey @nartamonov @etiennelb, I just merged #486 which should add dockerignore support back into kaniko. Please comment on this issue or open another if you run into an more issues, and again sorry for the trouble this bug has caused.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BenHizak picture BenHizak  路  4Comments

WesCossick picture WesCossick  路  3Comments

vvbogdanov87 picture vvbogdanov87  路  4Comments

WoodProgrammer picture WoodProgrammer  路  5Comments

ahsannaseem picture ahsannaseem  路  3Comments