Search code examples
nugetcontainersopenshiftrhel

nuget fails on RHEL7.9 OpenShift container


I'm working on OpenShift container, need to push some .nupkg package based on.nuspec file. I can't even run help, nor nuget pack or push, when trying to execute nuget in cli is giving me error.

sh-4.2$ nuget 
Access to the path '/.config/NuGet' is denied.

If I would like to pack it, error is the same :

sh-4.2$ nuget pack RDependencies.nuspec 
Access to the path '/.config/NuGet' is denied.

It was installed while Building container, with RUN yum install -y nuget; yum clean all

Container is based on: Red Hat Enterprise Linux Server release 7.9 (Maipo)

And nuget bin:

sh-4.2$ whereis nuget
nuget: /usr/bin/nuget
sh-4.2$ cat /usr/bin/nuget
#!/bin/sh
exec /usr/bin/mono /usr/lib/mono/nuget/NuGet.exe "$@"

sh-4.2$ 

Question: Is it possible to force nuget to create/read from /tmp/ directory which I've got access to?


Solution

  • Seems that I have figure it. The main problem here is OpenShift temporary user which is created during deployment. It doesn't have home directory created, and HOME env variable is set in root dir : HOME=/

    After changing it to, e.g. /tmp/

    export HOME=/tmp/home_dir/
    

    It starts to work

    sh-4.2$ nuget
    NuGet Version: 2.8.7.0
    usage: NuGet <command> [args] [options] 
    Type 'NuGet help <command>' for help on a specific command.
    
    sh-4.2$ nuget pack
    Please specify a nuspec or project file to use.
    sh-4.2$