Recent docker upgrade on Ubuntu breaks golang build in Azure DevOps buildagent

Recent apt upgrade on Ubuntu VM (self-hosted Azure DevOps build agent) updated docker and other programs. Now GO application failing build in the Azure DevOps pipeline on build agent.

Original after the upgrades related to permissions, but have made a lot of changes since with no success.

Initial error: failed to initialize build cache at $HOME/.cache/go-build: mkdir $HOME/.cache: permission denied
After some changes (resolving permissions…), received
go build : copying /tmp/go-build364xxx6971/b001/exe/a.out: open main: permission denied
now errors are related to the go.mod file

$docker version client and server 20.10.25
$go version go1.19.1 linux/amd64


Fixed: made a couple of changes (such as adding a precise WORKDIR path, base image, build flags) but adding RUN go mod init prior to the build command in my DOCKERFILE did the trick