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

kaniko cannot use scratch multi-stage build image #2787

Open
iCloudBot opened this issue Oct 10, 2023 · 3 comments
Open

kaniko cannot use scratch multi-stage build image #2787

iCloudBot opened this issue Oct 10, 2023 · 3 comments
Labels
area/filesystems For all bugs related to kaniko container filesystems (mounting issues etc) area/multi-stage builds issues related to kaniko multi-stage builds issue/from-scratch-image issue/rootfs kind/bug Something isn't working possible-dupe priority/p2 High impact feature/bug. Will get a lot of users happy

Comments

@iCloudBot
Copy link

iCloudBot commented Oct 10, 2023

When building a multi-stage image, it is always stuck in the previous step FROM scratch, and is always in Take snapshot of full filesystem... Saving file . for later use, unable to proceed to subsequent steps.
It cannot copy the entire root directory

My Dockerfile

FROM amazonlinux:2 as base

ADD openjdk-14.0.1_linux-x64_bin.tar.gz /usr/local

RUN yum upgrade -y && \
    yum install -y glibc-langpack-zh shadow-utils && \
    useradd -ml devops -u 10000 -s /sbin/nologin && \
    yum remove -y shadow-utils && \
    yum clean all

FROM scratch
COPY --from=base / /

ENV LANG=zh_CN.UTF-8 \
    LC_ALL=zh_CN.UTF-8 \
    LANGUAGE=zh_CN.UTF-8 \
    JAVA_HOME=/usr/local/jdk-14.0.1
ENV PATH=$JAVA_HOME/bin:$PATH

CMD ["java", "-version"]
@plachta11b
Copy link

Arent you missing AS keyword in the base image stage? It should be probably FROM amazonlinux:2 AS base to make it work.

@iCloudBot
Copy link
Author

Arent you missing AS keyword in the base image stage? It should be probably FROM amazonlinux:2 AS base to make it work.

I'm sorry for missing the as base critical step, the Dockerfile contents have been updated, but still the image build is not successful. The build log looks like this:
error building image: could not save file: copying file: open /kaniko/0/kaniko/....../0/kaniko/0/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt: file name too long
20231018102900

@aaron-prindle aaron-prindle added area/multi-stage builds issues related to kaniko multi-stage builds issue/from-scratch-image priority/p2 High impact feature/bug. Will get a lot of users happy kind/bug Something isn't working area/filesystems For all bugs related to kaniko container filesystems (mounting issues etc) issue/rootfs possible-dupe labels Oct 19, 2023
@aaron-prindle
Copy link
Collaborator

This is likely a dupe of:
#2210

(also seems related to)
#2033

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/filesystems For all bugs related to kaniko container filesystems (mounting issues etc) area/multi-stage builds issues related to kaniko multi-stage builds issue/from-scratch-image issue/rootfs kind/bug Something isn't working possible-dupe priority/p2 High impact feature/bug. Will get a lot of users happy
Projects
None yet
Development

No branches or pull requests

3 participants