Well, it finally happened. Despite the added assurances of working with containers and Kubernetes, the old “It works on my machine” scenario reared its ugly head in my .NET Core (C#) code. The image that I created worked fine on my local PC—a Fedora 32 machine—but it crashed when I tried running it in my Red Hat OpenShift cluster.
The error was “Unable to obtain lock file access on /tmp/NuGetScratch.” Let’s take a quick look at what happened, and then I’ll explain how I fixed it.
After a lot of web searching and a discussion with a Red Hat .NET Core engineer, I discovered the underlying problem. It turns out that within a container, the identity used to initially run the program (using the
dotnet run command) must be the same for subsequent users.
The problem might be easy to understand, but what’s the solution?
Continue reading “How to fix .NET Core’s ‘Unable to obtain lock file access’ error on Red Hat OpenShift”