Apache Traffic Server is an enterprise-grade proxy and caching server initially developed by Yahoo, then later made open source and managed by the Apache Foundation.
The below code is a Dockerfile that will download and build ATS on the latest Ubuntu base image. Currently, we’re using Apache Traffic Server version 8.0.5, but if you’d like to use a different version or check for a later version then you’ll need to replace the curl command with one of the downloads available from here.
Create a new folder on your Docker host and add the below text to the dockerfile.
mkdir ats vi ats/dockerfile
FROM ubuntu:latest # Update the package repository RUN set -x \ && DEBIAN_FRONTEND=noninteractive apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \ && DEBIAN_FRONTEND=noninteractive apt-get install -y \ curl \ locales \ build-essential \ bzip2 \ libssl-dev \ libxml2 \ libxml2-dev \ libpcre3 \ libpcre3-dev \ tcl \ tcl-dev \ libboost-dev \ # Configure locale && export LANGUAGE=en_US.UTF-8 \ && export LANG=en_US.UTF-8 \ && export LC_ALL=en_US.UTF-8 \ && locale-gen en_US.UTF-8 \ && DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales # Get ATS and build # http://www-eu.apache.org/dist/trafficserver/ RUN mkdir /tmp/trafficserver \ && cd /tmp/trafficserver \ && curl -L http://www-eu.apache.org/dist/trafficserver/trafficserver-8.0.5.tar.bz2 | tar -xj --strip-components 1 \ && ./configure \ && make install \ && make distclean \ && cd / \ # Clean-up && apt-get purge --auto-remove -y \ curl \ build-essential \ bzip2 \ libssl-dev \ libxml2-dev \ libpcre3-dev \ tcl-dev \ libboost-dev \ && apt-get clean \ && rm -rf /tmp/* /var/lib/apt/lists/* RUN ln -s /usr/local/etc/trafficserver /etc/trafficserver EXPOSE 8080 ENTRYPOINT ["/usr/local/bin/traffic_server"]
To build the Apache Traffic Server image, cd into the ats directory and issue the build command. The period (.) at the end of the build command is there on purpose – make sure you include it in your build command.
cd ats docker build -t ats .
The build will take a few minutes, depending on your hardware, but will return you to the command line once completed.
Run your dockerfile and ATS will be available on port 8080, however, you’ll need to configure it as required. The config, such as remap.conf, is contained in /etc/trafficserver