Search code examples
dockerdockerfilecontainershaproxy

My HAproxy container exits every time i want to run it


My HAproxy container exits every time i try to run it .

I have tried to run it without --d to see why it exited and I get the following output:

$ sudo docker run  --name=hapr -p 80:80 -v /haproxy/:/usr/local/etc/haproxy/  haproxy

I get this output:

HA-Proxy version 2.1.4 2020/04/02 - https://haproxy.org/ Status: stable branch - will stop receiving fixes around Q1 2021. Known bugs: http://www.haproxy.org/bugs/bugs-2.1.4.html Usage : haproxy [-f <cfgfile|cfgdir>]* [ -vdVD ] [ -n <maxconn> ] [ -N <maxpconn> [ -p <pidfile> ] [ -m <max megs> ] [ -C <dir> ] [-- <cfgfile>* -v displays version ; -vv shows known build options. -d enters debug mode ; -db only disables background mode. -dM[<byte>] poisons memory with <byte> (defaults to 0x50) -V enters verbose mode (disables quiet mode) -D goes daemon ; -C changes to <dir> before loading files. -W master-worker mode. -q quiet mode : don't display messages -c check mode : only check config files and exit -n sets the maximum total # of connections (uses ulimit -n) -m limits the usable amount of memory (in MB) -N sets the default, per-proxy maximum # of connections (0) -L set local peer name (default to hostname) -p writes pids of all children to this file -de disables epoll() usage even when available -dp disables poll() usage even when available -dS disables splice usage (broken on old kernels) -dG disables getaddrinfo() usage -dR disables SO_REUSEPORT usage -dr ignores server address resolution failures -dV disables SSL verify on servers side -sf/-st [pid ]* finishes/terminates old pids. -x <unix_socket> get listening sockets from a unix socket -S <bind>[,<bind options>...] new master CLI

If I list the container I get the following message:

$ docker container ls -a

Exited (1) 3 minutes ago

Solution

  • I have fixed my problem , If someone get same problem . So just you should have the full path in your command . instaed of

    $ sudo docker run  --name=hapr -p 80:80 -v /haproxy/:/usr/local/etc/haproxy/  haproxy
    

    use

    $ sudo docker run  --name=hapr -p 80:80 -v /home/ubuntu/haproxy/:/usr/local/etc/haproxy/  haproxy
    

    also you should have haproxy.cfg allready in your host .