genuinetools / img

Standalone, daemon-less, unprivileged Dockerfile and OCI compatible container image builder.
https://blog.jessfraz.com/post/building-container-images-securely-on-kubernetes/
MIT License
3.88k stars 230 forks source link

img buld has issue with access files in image when running in k8s with root user #318

Open pangzhj opened 3 years ago

pangzhj commented 3 years ago

When running in a pod in k8s, img has problem access file during build. img is running with root user in the pod. While running in ubuntu with non-root user, there is no such problem.

RUN ls -l /root/.nuget/plugins/netcore/CredentialProvider....

9 5.770 -rwxrwxrwx 1 root root 120712 Jun 18 2020 /root/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll

9 DONE 5.8s

Determining projects to restore...

14 21.53 /usr/share/dotnet/sdk/3.1.301/NuGet.targets(128,5): error : Problem starting the plugin '/root/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll'. No such file or directory [/build/WebAPIs/Subscription/Subscription.csproj]

14 22.03 /usr/share/dotnet/sdk/3.1.301/NuGet.targets(128,5): error : Unable to load the service index for source https://visionlink.pkgs.visualstudio.com/_packaging/VSS/nuget/v3/index.json. [/build/WebAPIs/Subscription/Subscription.csproj]