Closed aslansutu closed 3 months ago
When I set the USER as root and built the image, this time I came accross the following error
haproxy_1 | [NOTICE] (16) : haproxy version is 2.9.7-5742051
haproxy_1 | [ALERT] (16) : config : parsing [/usr/local/etc/haproxy/haproxy.cfg:13] : The 'reqadd' directive is not supported anymore since HAProxy 2.1. Use 'http-request add-header' instead.
haproxy_1 | [ALERT] (16) : config : parsing [/usr/local/etc/haproxy/haproxy.cfg:58] : The 'reqadd' directive is not supported anymore since HAProxy 2.1. Use 'http-request add-header' instead.
haproxy_1 | [ALERT] (16) : config : Error(s) found in configuration file : /usr/local/etc/haproxy/haproxy.cfg
haproxy_1 | [ALERT] (16) : config : Fatal errors found in configuration.
It turns out that in src/haproxy/haproxy.cfg
, the following has to be changed from
reqadd X-Forwarded-Proto:\ http
reqadd X-Forwarded-Proto:\ https
to
http-request set-header X-Forwarded-Proto http
http-request set-header X-Forwarded-Proto https
as explained here
Ran into the same issue and posted my solution on the OpenBalena forum. I modified the Dockfile to to only temporarily switch to the root user as running a container as root is considered a bad practise.
FROM haproxy:2.9.6-alpine
VOLUME [ "/certs" ]
# Switch back to root to install packages
USER root
RUN apk add --update inotify-tools
# Make haproxy user owner of certificate directory (is root by default)
RUN chown haproxy:haproxy /etc/ssl/private
# Switch back to haproxy user
USER haproxy
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
COPY start-haproxy.sh /start-haproxy
CMD /start-haproxy
https://forums.balena.io/t/logbackend-server-responded-with-status-code-504-mystery-solved/369223/10
Hello all,
Starting from a fresh install and build, I am unable to build the Docker containers. Here is a partial output of
./scripts/compose up -d
;I noticed that there was a recent commit #172 has updated the Dockerfile. Once I manually downgraded the version to 1, I was able to successfully build it.
I went ahead and pulled the image and was also unable to run the command manually. It looks like
apk
needs to be run as root. I believe haproxy image uses the user haproxy. So maybe addingUSER root
to the Dockerfile may be a solution. However I am not sure how everything else may be effected.