marathon-lb: Problem using docker image /marathon-lb/haproxy.cfg missing

I dont know if I did something wrong or the image is broken, but I cant launch marathon-lb using the official image. I always get the same error:

[root@xxx-1 ~]# docker run -e "PORTS=80" -e "URL=http://my-ip:8080" mesosphere/marathon-lb event http://my-ip:9090
Generating RSA private key, 2048 bit long modulus
.......................................+++
...........................+++
e is 65537 (0x10001)
Signature ok
subject=/CN=*
Getting Private key
Using http://my-ip:9090 as event callback-url
Reloading haproxy
[ALERT] 063/203255 (19) : Could not open configuration file /marathon-lb/haproxy.cfg : No such file or directory
Invalid config
usage: marathon_lb.py [-h] [--longhelp] [--marathon MARATHON [MARATHON ...]]
                      [--listening LISTENING] [--callback-url CALLBACK_URL]
                      [--haproxy-config HAPROXY_CONFIG] [--group GROUP]
                      [--command COMMAND] [--sse] [--health-check]
                      [--dont-bind-http-https] [--ssl-certs SSL_CERTS]
                      [--skip-validation] [--dry]
                      [--syslog-socket SYSLOG_SOCKET]
                      [--log-format LOG_FORMAT]
                      [--marathon-auth-credential-file MARATHON_AUTH_CREDENTIAL_FILE]
                      [--auth-credentials AUTH_CREDENTIALS]
marathon_lb.py: error: argument --marathon/-m is required

The hub.docker.io documentation do not cover the usage, can you help me?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

@cgbaker Thanks, it was actually mine fault. Port 80 and 443 were already binded on the host.

exec docker run --privileged -e PORTS="9090,9091,4080,4443" --net=host \
        -v /srv/marathon-lb/templates:/marathon-lb/templates \
        mesosphere/marathon-lb sse -m http://${MARATHON} --group '*' \
        >> /var/log/marathon-lb/marathon-lb.log 2>&1

I’ve mounted /marathon-lb/templates created files templates/HAPROXY_HTTP_FRONTEND_HEAD and templates/HAPROXY_HTTPS_FRONTEND_HEAD for overriding binding ports 80 and 443 to different ones.

@stupied4ever You need to pass the --listening parameter as well as the callback URL. I am running in docker, and I was having the same issue until I added that param. Here’s my full docker run string:

docker run --privileged -e PORTS=80,8888,8889 -p 8888:80 -p 8889:8889 \
    mesosphere/marathon-lb event "http://lb01:8889" \
    --marathon http://marathon:8080 \
    --group "*" --listening http://0.0.0.0:8889

The haproxy.cfg is a red-herring. You are missing the --marathon/-m argument, per the last line of output. This is provided as part of the default commands for the docker images, but you’re overriding those with sse ...

For example, docker run -e "PORTS=80" -e "URL=http://my-ip:8080" mesosphere/marathon-lb event http://my-ip:9090 --marathon http://localhost:8080 You’ll find next that you’re missing the --group argument as well; use --group "*" unless you know better.

(What’s up with the URL environment variable?)