Skip to content

Permission issue when generating code using docker #35

@tkrop

Description

@tkrop

I struggled a bit to get the example running from the README.md.

docker run -it --rm \
  --volume $(pwd):/app:rw
  ghcr.io/slok/kube-code-generator:v0.2.0 \
  --apis-in ./apis --go-gen-out ./client --crd-gen-out ./manifests

was leading to a permission error the container was prepared to address by starting as follows:

docker run -it --rm \
  --user $(id -u):$(id -g) \
  --volume $(pwd):/app:rw \
  ghcr.io/slok/kube-code-generator:v0.2.0 \
  --apis-in ./apis --go-gen-out ./client --crd-gen-out ./manifests

However, this does not fix the issue, since the container tries to create the user .cache in the root directory now, which fails the same way with a permission error. So finally, I came up with

docker run -it --rm \
  --env HOME=/app \
  --user $(id -u):$(id -g) \
  --volume $(pwd):/app:rw \
  ghcr.io/slok/kube-code-generator:v0.2.0 \
  --apis-in ./apis --go-gen-out ./client --crd-gen-out ./manifests

Which is working.

@slok May be you like to fix this in the Dockerfile and improve the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions