Public | Automated Build

Last pushed: 2 months ago
Short Description
Base Docker images based on Alpine Linux
Full Description

What is Alpine Linux?

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.

About

This image is derived from the well tested and documented Alpine Docker image image adding:

Motivation

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 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:

  • 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 search keyword 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

Usage

The official Alpine Docker image is well documented, so check out their documentation to learn more about building micro Docker images with Alpine Linux.

Basic usage

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

Supervised usage

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

Manage services

DNS resolver

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

Consul Template

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.

Build

This project is configured as an automated build in Dockerhub.

Each branch give the related image tag.

License

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.

Docker Pull Command
Owner
bandsintown

Comments (0)