FROM bitnami/haproxy # Copy config COPY ./docker/haproxy.cfg /bitnami/haproxy/conf/haproxy.cfg # Directory for the runtime API socket. HAProxy runs as uid 1001 here and binds # a unix socket by creating `..tmp` and renaming it over the target, # so it needs write permission on the *directory*, not just the file — which is # also why a stale socket left by a previous run is harmless. # # /var/lib is owned by root, hence the explicit USER switch. Docker copies this # ownership onto an empty named volume when it initialises one here, so the # volume shared with certbot comes up writable by HAProxy without a chown at # runtime. USER root RUN mkdir -p /var/lib/haproxy && chown 1001:1001 /var/lib/haproxy USER 1001