Alpine Linux v3.8.1 with HAProxy v1.8.2 installed at /usr/sbin/haproxy. 12MB.
9.3K
A handy basic image by Steven Iveson, comprising of;
For previous tags v6 and v7:
For previous tag v5:
I'd expect you use this image as a simple web server proxy that can be quickly modified, if required, via volume mounts.
To replace the HAProxy configuration file with your own, mount a volume to /etc/haproxy/ which contains your own haproxy.cfg. Alternatively mount just the file.
To place SSL/TLS certificates in the default location, mount a volume to /etc/ssl/private/ which contains the necessary files.
The following headers are added to responses if not already present;
The following are removed;
HAProxy is started via the /usr/bin/haproxy.sh script, which runs as PID1;
ps -e commanddocker stop command by default, is 'trapped' by the script and will stop the containerOn the downside, you can't restart the process(es).
Use this command to pull the image manually and before runtime:
sudo docker pull itsthenetwork/alpine-haproxy:latest
This command will start the container non-interactively, using host networking mode; thus port 8080 will be used on the localhost (note there is no need for privileged mode):
sudo docker run -d --net=host --name haproxy itsthenetwork/alpine-haproxy:latest
If you'd rather use the default bridge mode networking and map a port from your host to the container, use something like this:
sudo docker run -d -p 5010:8080 --name haproxy itsthenetwork/alpine-haproxy:latest
As long as you are using host mode networking as specified above, you can confirm the container and HAProxy within it is listening on port 8080 using this command:
ss -ltn
Alternatively on old/bare/BusyBox systems use:
netstat -ltn
You can 'attach' to your container like so (assuming you used the run command and --name parameter above):
docker exec -it haproxy sh
You can view the container's logs like so (assuming you used the run command and --name parameter above):
sudo docker logs haproxy
Stop and remove the container like so (assuming you used the run command and --name parameter above):
docker stop haproxy; docker rm haproxy
To save performing the remove step add --rm=true to your docker run command and remove the -d parameter. This will result in:
sudo docker run --rm=true --net=host --name haproxy itsthenetwork/alpine-haproxy:latest
If you wanted to install additional packages and build your own image based upon this one you'd start your Dockerfile like this:
FROM itsthenetwork/alpine-haproxy:latest
RUN apk -add U -v package_name package_name
...
The Dockerfile used to create this image is available at the root of the file system, here it is anyway:
FROM alpine:latest
MAINTAINER Steven Iveson <[email protected]>
LABEL maintainer "Steven Iveson <[email protected]>"
COPY Dockerfile /Dockerfile
RUN echo "http://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories && \
apk add -U -v haproxy openssl && \
rm -rf /var/cache/apk/* /tmp/*
COPY haproxy.cfg /etc/haproxy/haproxy.cfg
COPY errorfiles/* /etc/haproxy/
COPY haproxy.sh /usr/bin/haproxy.sh
RUN chmod +x /usr/bin/haproxy.sh
ENTRYPOINT ["/usr/bin/haproxy.sh"]
Content type
Image
Digest
Size
5.6 MB
Last updated
about 8 years ago
docker pull itsthenetwork/alpine-haproxy