Kaniko: Multistage COPY fails `gcr.io/kaniko-project/executor:debug`

Created on 23 May 2020  路  5Comments  路  Source: GoogleContainerTools/kaniko

I just tested with gcr.io/kaniko-project/executor:debug

#: Dockerfile
FROM python:3.7.7-slim-buster as part-one
RUN set -x \
    && python -m venv /venv
RUN ls -l /venv

FROM python:3.7.7-slim-buster
COPY --from=part-one /venv /venv
RUN ls -l /venv

It's failing.

INFO[0016] args: [-c ls -l /venv]
ls: cannot access '/venv': No such file or directory
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 2

_Originally posted by @dmilan77 in https://github.com/GoogleContainerTools/kaniko/issues/1110#issuecomment-632946871_

Most helpful comment

Do you by chance have a .dockerignore file?

There seems to be a recent regression where the .dockerignore is read during multi-stage builds so the files are ignored when the copy takes place.

I use a .dockerignore in whiltelist mode and this caught me out as as well.

All 5 comments

Do you by chance have a .dockerignore file?

There seems to be a recent regression where the .dockerignore is read during multi-stage builds so the files are ignored when the copy takes place.

I use a .dockerignore in whiltelist mode and this caught me out as as well.

Do you by chance have a .dockerignore file?

There seems to be a recent regression where the .dockerignore is read during multi-stage builds so the files are ignored when the copy takes place.

I use a .dockerignore in whiltelist mode and this caught me out as as well.

It did the trick. Seems still a bug.

Same case here, using .dockerignore in whitelist mode, either removing the .dockerignore or setting it to * right before the building may be a workaround while this is solved

@ejose19 Can you try with latest v0.23.0 version? With this release, .dockerignore is only applied for copy statements in first stage.

@tejal29 Can confirm v0.23.0 fixed the issue.

OT: Can you take a look on this issue #1265 ? It still doesn't work even on latest release.

Was this page helpful?
0 / 5 - 0 ratings