Docker on macOS Ignoring /etc/resolver/*

August 14, 2023

I ran across a weird issue recently.  I run macOS Sonoma (14.0 Public Beta 2) and use Colima as my Docker engine.  Since I manage a few different environments, I place my various DNS domains with their configs into /etc/resolver/*.  For some reason, both docker-compose build and docker compose build refused to utilize these files.  Due to this, I wasn't able to grab my image because Docker was unable to resolve the FQDN.  Not wanting to change my system's DNS globally, I searched for a fix or a temporary workaround and...I found a workaround (for now).

Next time you go to build your services, prepend the following:

DOCKER_BUILDKIT=0

Of course, this is just an environment variable so you can put it in your bashrc/zshrc/etc. I chose to prepend it to my build command and not add it to my zshrc so that I would only revert back to the old build process for this one particular action.

Your full command would look like this:

DOCKER_BUILDKIT=0 docker compose build

Here's hoping for a patch to come out soon...

To help folks find this solution, the error that is seen due to this issue looks like this:

failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize: rpc error: code = Unknown desc = failed to fetch oauth token: Post "https://FQDN/v2/token": dial tcp: lookup FQDN on WRONG_DNS_SERVER:53: no such host

©2024 Tyler Wright