After upgrading to macOS 12 Monterey I started getting the following error when using docker with the ACR Docker Credential Helper:
[code language=”shell”]
fatal error: runtime: bsdthread_register error
[/code]
This error is caused when using a Golang binary that has been compiled with an older version of the Golang compiler, you can find out more in the MacOS12BSDThreadRegisterIssue Golang wiki.
You can run the command helper by hand to verify that it is generating the error:
[code language=”shell”]
docker-credential-acr-darwin list
[/code]
If you use the instructions provided by Microsoft to install the ACR Docker Credential Helper binary then you have installed a binary that is compiled with a fairly old version of Golang. The fix for the error is to recompile the ACR Docker Credential Helper using a newer version of Golang.
To recompile using a newer version you will first need to clone the helper github repo:
[code language=”shell”]
git clone https://github.com/Azure/acr-docker-credential-helper
[/code]
Then you will need to edit the Dockerfile so that the Golang version used is a supported version on macOS 12, I found that version 1.15 worked and the helper still compiled:
[code language=”shell”]
FROM golang:1.15-alpine
RUN apk update && apk add make bash zip
ADD . /build-root
WORKDIR /build-root
CMD make
[/code]
After modifying the Dockerfile you can build the binary by running the build.sh script. This script will build the helper for multiple platforms and put the results in the artifacts directory. The artifacts/docker-credential-acr-darwin-amd64.tar.gz file is the one with the new macOS binaries. The two binaries will need to be extracted from that file and put in the /usr/local/bin/ directory.
You can verify that the update has fixed the issue by running the helper by hand again:
[code language=”shell”]
docker-credential-acr-darwin list
[/code]