When building a new Docker image from Alpine 3.6 (RUN apk –update add –virtual build-dependencies gcc ...), I encountered the following errors:
- fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
- ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.6/main: temporary error (try again later)
- WARNING: Ignoring APKINDEX.84815163.tar.gz: No such file or directory
- fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
- ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.6/community: temporary error (try again later)
- WARNING: Ignoring APKINDEX.24d64ab1.tar.gz: No such file or directory
- ERROR: unsatisfiable constraints:
I found 2 separate solutions to work around these errors.
- Utilize “–network=host” when building the new image.
- This option will force the Dockfile’s “Run” instruction to use the Docker host network stack
- Set the Docker DNS server globally on the build host. Add “-dns x.x.x.x” to the DOCKER_OPTS variable. After you make this property change, you will need bounce the Docker daemon.
I’m also going to try to update my Dockerfile to work around this issue, but wanted to get this info documented before I forget.