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

Unable to use kaniko-action with runner in GKE with workload identity #128

Closed
bymarshall opened this issue Apr 14, 2022 · 1 comment · Fixed by #291
Closed

Unable to use kaniko-action with runner in GKE with workload identity #128

bymarshall opened this issue Apr 14, 2022 · 1 comment · Fixed by #291

Comments

@bymarshall
Copy link

As is documented here, workload identity in GKE is one of the possible methods to authenticate kaniko and push images to GCR:
https://github.com/GoogleContainerTools/kaniko#pushing-to-gcr-using-workload-identity

I'm trying to use this action with a github action runner in a GKE Cluster with workload identity enabled, however, since I'm not providing a ~/.docker/config.json file, the job is always failing with the following error:

error building image: /kaniko/.docker/config.json: read /kaniko/.docker/config.json: is a directory
Error: The process '/usr/local/bin/docker' failed with exit code 1

In order to fix this problem and provide compatibility, I think you should mount the ~/.docker directory instead of the config.json file, currently if this file doesn't exist, docker is mounting it as a folder instead of a file and kaniko is trying to use it.

The modification should look like this:

export const generateArgs = (inputs: Inputs, outputDir: string): string[] => {
  const args = [
    // docker args
    'run',
    '--rm',
    '-v',
    `${path.resolve(inputs.context)}:/kaniko/action/context:ro`,
    '-v',
    `${outputDir}:/kaniko/action/output`,
    '-v',
    `${os.homedir()}/.docker:/kaniko/.docker:ro`,
@Jerome1337
Copy link
Contributor

Related to #84 (comment)

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

Successfully merging a pull request may close this issue.

2 participants