You may want to use a custom DNS on an Alpine image due to networking issues or if you have a preferred DNS provider. This guide will help you to set the DNS when using an Alpine image while using CircleCI.
Instructions
You can use the following echo command to set the nameserver to 8.8.8.8 but this can be set to any DNS server. If you would like to have multiple you will need to add another \nnameserver x.x.x.x with your preferred DNS settings after the nameserver section.
steps:
- run: cat /etc/resolv.conf
- run: echo -e "search ec2.internal\nnameserver 8.8.8.8\noptions ndots:0" > /etc/resolv.conf
- run: cat /etc/resolv.conf
Outcome
Once this has been set your DNS requests will use the DNS servers that you have set on the /etc/resolv.conf file.
Additional Resources
The following support article is about how to set custom DNS on Ubuntu:
The following link is the official Alpine Linux networking link:
https://wiki.alpinelinux.org/wiki/Configure_Networking
Comments
Article is closed for comments.