When building a new Docker image from Alpine 3.6 (RUN apk –update add –virtual build-dependencies gcc ...), I encountered the following errors:

I found 2 separate solutions to work around these errors.

  1. Utilize “–network=host” when building the new image.
    • This option will force the Dockfile’s “Run” instruction to use the Docker host network stack
  2. 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.

docker

Hello, Welcome to DevOpsUnleashed!

A blog dedicated to sharing information about DevOps. Here, you’ll find examples, tips, and tutorials on DevOps.

Feel free to share your experiences in the comments!

Blog Categories