I have a running node server which listens on 3 different ports.
I have three different subdomains of a url pointing to port 80 of the server on which node is running/listening.
What I am trying to do is proxy pass a request from a sub-domain to its respective port using haproxy.
My node server is dockerized with the ports exposed on the host. I can hit them individually using the server's IP address on their port so they seem to be running fine.
My haproxy will also be running inside a docker container. I am completely new to haproxy though I am fairly confident with dockers. I wrote my haproxy configuration via onine articles and blogs but as soon as I start my docker container using: 
docker run --name my-running-haproxy \
  -v ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro \
  haproxy:1.6.2
I get the following error:
Error response from daemon: ./haproxy.cfg includes invalid characters for a local volume name, only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed
So I tried debugging by removing configuration options until I had a very minimalistic config:
global
    maxconn 256
    debug
defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms
frontend http-in
    bind *:80
    default_backend default-server
backend default-server
    server s0 127.0.0.1:3000
But still I am getting the same error.
Can anyone help me in this?
I had the same problem and solved it by using full path to my config file.
docker run --name my-running-haproxy \
  -v ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro \
  haproxy:1.6.2
docker run --name my-running-haproxy \
  -v /usr/local/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro \
  haproxy:1.6.2
$ docker -v
Docker version 1.11.2, build b9f10c9
Using relative path:
Example:
./haproxy.cfgExample:
./PATH/haproxy.cfgExample hidden file:
./PATH/.haproxy.cfg
  -v ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
Using absolute path:
Example:
/haproxy.cfgExample:
/PATH/haproxy.cfgExample hidden file:
/PATH/.haproxy.cfgExample:
$PWD/haproxy.cfg
  -v /PATH/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With