[Bug 1855140] Re: haproxy package misses creation of default stats socket path in Docker container
Christian Ehrhardt
1855140 at bugs.launchpad.net
Mon Dec 9 14:49:32 UTC 2019
Adding a systemd task as I really think this is more a general than a
haproxy specific discussion/bug/feature.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1855140
Title:
haproxy package misses creation of default stats socket path in Docker
container
Status in haproxy package in Ubuntu:
New
Status in systemd package in Ubuntu:
New
Bug description:
When installing the haproxy package from the current Ubuntu 18.04
Bionic repos, the package does not install the directory /run/haproxy.
This directory is mentioned in the default config file
/etc/haproxy/haproxy.cfg:
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd
listeners
Starting HAProxy manually will show the following error:
# /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg
[ALERT] 337/154339 (24) : Starting frontend GLOBAL: cannot bind UNIX socket [/run/haproxy/admin.sock]
After manual creation of the directory, the start works:
# mkdir /run/haproxy
# /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg
# ps auxf
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 10 0.1 0.0 18616 3416 pts/0 Ss 15:42 0:00 /bin/bash
root 32 0.0 0.0 34400 2900 pts/0 R+ 15:45 0:00 \_ ps auxf
root 1 0.0 0.0 18376 3016 ? Ss 15:40 0:00 bash /root/entrypoint.sh
haproxy 31 0.0 0.0 54284 1252 ? Ss 15:45 0:00 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg
This can be reproduced with a simple Docker container the following
Dockerfile:
----------------------------------------------
FROM ubuntu:18.04
MAINTAINER Claudio Kuenzler <ck at claudiokuenzler.com>
# install packages
RUN apt-get update \
&& apt-get install -y -qq haproxy
CMD ["/usr/sbin/haproxy","-f","/etc/haproxy/haproxy.cfg"]
----------------------------------------------
Checking the haproxy package for the run directory shows nothing:
# dpkg -L haproxy | grep run ; date
Wed Dec 4 15:58:52 UTC 2019
*******************************************
Update: After analysis of the haproxy package (see
https://www.claudiokuenzler.com/blog/917/haproxy-ubuntu-18.04-docker-
image-not-starting-cannot-bind-unix-socket), it turns out that the
/run/haproxy directory is defined in debian/haproxy.tmpfile. However
tmpfile's are only considered in systems with SystemD. As Docker
containers run without Systemd, this directory is never created.
Suggestion: Do not rely on Systemd to create /run/haproxy. Maybe use
debian/haproxy.dirs? However the permissions are not set in this case.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/haproxy/+bug/1855140/+subscriptions
More information about the foundations-bugs
mailing list