What is Alpine Linux?
This makes Alpine Linux a great image base for utilities and even production applications. Read more about Alpine Linux here and you can see how their mantra fits in right at home with Docker images.
This image is derived from the well tested and documented Alpine Docker image image adding:
- the s6 supervisor for containers
- a lightweight DNS resolver with minimal runtime and filesystem overhead
- Consul Template for service discovery and configuration management
- some useful packages:
Alpine Linux does not support the
search keyword in resolv.conf. This breaks many tools that rely on DNS service discovery (e.g. Kubernetes, Tutum.co, Consul).
Additionally Alpine Linux deviates from the established concept of primary and secondary nameservers. This leads to problems in cases where the container is configured with multiple nameserver with inconsistent records (e.g. one Consul server and one recursing server).
To overcome these issues the image includes a lightweight (1.2 MB) container-only DNS resolver that replicates the behavior of GNU libc's stub-resolver.
How it works
On container start the DNS resolver parses the
search entries from
resolv.conf and configures itself as nameserver for the container. DNS queries from local processes are handled following these conventions:
- The nameserver listed first in resolv.conf is always queried first. Additional nameservers are treated as fallbacks.
- Hostnames are qualified by appending the domains configured with the
searchkeyword in resolv.conf
- Single-label hostnames (e.g.: "redis-master") are always qualified with search domains
- Multi-label hostnames are first tried as absolute names and only then qualified with search domains
The official Alpine Docker image is well documented, so check out their documentation to learn more about building micro Docker images with Alpine Linux.
Building your own image based on this image is as easy as:
FROM bandsintown/alpine RUN apk-install <package_name> CMD ["/bin/bash"]
docker run -ti bandsintown/alpine
By default the s6 supervisor is not enabled because the
ENTRYPOINT is not defined.
FROM bandsintown/alpine RUN apk-install <package_name> ENTRYPOINT ["/init"] CMD ["/bin/bash"]
docker run -ti --entrypoint=/init bandsintown/alpine bash
In the case you need to disable the DNS resolver you can just pass the environment variable
docker run -ti --entrypoint=/init -e DISABLE_DNSMASQ=true bandsintown/alpine bash
In the case you need to disable Consul Template you can just pass the environment variable
docker run -ti --entrypoint=/init -e DISABLE_CONSUL_TEMPLATE=true bandsintown/alpine bash
CONSUL_ADDRESS might be passed as an environment variable to define the address of Consul:
docker run -ti --entrypoint=/init -e CONSUL_ADDRESS=demo.consul.io bandsintown/alpine bash
Alternatively if you run your containers on AWS and you need to get the host IP, you can use the variable
docker run -ti --entrypoint=/init -e RUN_ON_AWS=true bandsintown/alpine bash
The configuration of Consul template must be located in
This project is configured as an automated build in Dockerhub.
Each branch give the related image tag.
All the code contained in this repository, unless explicitly stated, is
licensed under ISC license.
A copy of the license can be found inside the LICENSE file.