制作haproxy镜像
FROM centos-base:7.7.1908
LABEL maintanier="miaosen.guo 952726682@qq.com"
RUN yum install -y epel-release && yum install -y vim wget tree lrzsz gcc gcc-c++ automake proc proc-devel zlib zlib-devel openssl openssl-devel iproute net-tools iotop unzip screen tcpdump
ADD haproxy-2.0.5.tar.gz /usr/local/src/
RUN cd /usr/local/src/haproxy-2.0.5 && make ARCH=x86_64 TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1 USE_CPU_AFFINITY=1 PREFIX=/usr/local/haproxy && make install PREFIX=/usr/local/haproxy &&cp haproxy /usr/sbin && make /usr/local/haproxy/run
ADD haproxy.cfg /etc/haproxy
ADD run_haproxy.sh /etc/haproxy
EXPOSE 80 9999
CMD ["/usr/bin.run_haproxy.sh"]
haproxy.sh
#!/bin/bash
/usr/local/haproxy/sbin/haproxy -f /etc/local/haproxy/haproxy.cfg
tail -f /etc/hosts