Base Docker images based on Alpine Linux
7.1K

Alpine Linux is a very small Linux distribution built around musl libc and BusyBox.
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:
bash, tree, curl, wgetAlpine 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.
On container start the DNS resolver parses the nameserver and search entries from resolv.conf and configures itself as nameserver for the container. DNS queries from local processes are handled following these conventions:
search keyword in resolv.confThe 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"]
or :
docker run -ti bandsintown/alpine
By default the s6 supervisor is not enabled because the ENTRYPOINT is not defined.
To use s6 as a supervisor and enabling the pre-bundled services
(DNS resolver and Consul Template)
you have to define an entrypoint:
FROM bandsintown/alpine
RUN apk-install <package_name>
ENTRYPOINT ["/init"]
CMD ["/bin/bash"]
or :
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 DISABLE_DNSMASQ:
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 DISABLE_CONSUL_TEMPLATE:
docker run -ti --entrypoint=/init -e DISABLE_CONSUL_TEMPLATE=true bandsintown/alpine bash
The 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 RUN_ON_AWS:
docker run -ti --entrypoint=/init -e RUN_ON_AWS=true bandsintown/alpine bash
The configuration of Consul template must be located in /etc/consul-template/conf.
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.
Content type
Image
Digest
sha256:0f55168dc…
Size
23.9 MB
Last updated
over 2 years ago
docker pull bandsintown/alpine