Fixing Alpine Linux CDN Errors in Coolify Docker Compose Builds

29 Mar 2025 / 2 min read
Coolify/ Oracle/ OCI/ Docker
Contents · 3 sections

I’ve been writing a chatbot with an OpenRouter community Go client. I deployed it easily enough on Coolify alongside the other Go and Node.js stuff. But it was a good chance to reacquaint myself with Oracle Cloud Infrastructure (OCI) and the Coolify instance I have there.

It was a pain. Deployment via Coolify’s Docker Compose kept failing right at the start for something that looked like a network issue:

> [app first  2/11] RUN apk add build-base:
0.173 fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/aarch64/APKINDEX.tar.gz
5.178 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.21/main: temporary error (try again later)
5.178 fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/aarch64/APKINDEX.tar.gz
10.18 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.21/community: temporary error (try again later)
10.18 ERROR: unable to select packages:
10.18   build-base (no such package):
10.18     required by: world[build-base]
---

failed to solve: process "/bin/sh -c apk add build-base" did not complete successfully: exit code: 1
exit status 1
Oops something is not okay, are you okay? 😢
failed to solve: process "/bin/sh -c apk add build-base" did not complete successfully: exit code: 1
exit status 1

The Usual Suspects

Ugh.

Solution (after way too long)

Your Docker Compose build needs to explicitly use the host network. Docker documents build.network as the network used by RUN instructions during a build. This was the configuration that worked for me:

build:
  context: .
  dockerfile: Dockerfile
  network: host

It’s not the standard, but OCI users seem to need this for the build phase:

  • Grabbing packages/dependencies
  • There’s an issue from within OCI

The Caveat

However, this does compromise the security posture somewhat. This gives the build process access to my host network. So all network services. From reading around it seems like this might be an issue with malicious stuff potentially accessing sensitive network resources, but I’m not competent in this, so don’t take this as good technical advice.

Caveat emptor!

— END OF POST —
© Zixian Chen