2023-08-30 21:13:08 +08:00
|
|
|
# Inspiration: https://github.com/Tecnativa/docker-socket-proxy/blob/master/haproxy.cfg
|
|
|
|
|
2023-08-24 20:09:21 +08:00
|
|
|
defaults
|
|
|
|
timeout connect 10s
|
2023-08-30 20:59:08 +08:00
|
|
|
timeout client 10s
|
|
|
|
timeout server 10s
|
2023-08-24 20:09:21 +08:00
|
|
|
|
2023-08-30 20:59:08 +08:00
|
|
|
frontend http
|
|
|
|
mode http
|
2023-08-24 20:09:21 +08:00
|
|
|
bind :2375
|
2023-08-30 20:59:08 +08:00
|
|
|
http-request deny unless { src 127.0.0.1 } || { src ::1 } || { src NC_IPV4_PLACEHOLDER } || { src NC_IPV6_PLACEHOLDER }
|
|
|
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/[a-zA-Z0-9_.-]+/((start)|(stop)|(restart)|(kill)) }
|
|
|
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers }
|
|
|
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/images }
|
|
|
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/info }
|
|
|
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/networks }
|
|
|
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/_ping }
|
|
|
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/volumes }
|
|
|
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/version }
|
2023-08-24 20:09:21 +08:00
|
|
|
http-request deny
|
|
|
|
default_backend dockerbackend
|
2023-08-30 20:59:08 +08:00
|
|
|
|
|
|
|
backend dockerbackend
|
|
|
|
mode http
|
|
|
|
server dockersocket /var/run/docker.sock
|