Error response from daemon: (config) includes invalid characters for a local volume name

匿名 (未验证) 提交于 2019-12-03 08:59:04

问题:

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:

haproxy.cfg

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?

回答1:

I had the same problem and solved it by using full path to my config file.

Original

docker run --name my-running-haproxy \   -v ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro \   haproxy:1.6.2 

Fixed

docker run --name my-running-haproxy \   -v /usr/local/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro \   haproxy:1.6.2 


回答2:

$ docker -v Docker version 1.11.2, build b9f10c9 

Using relative path:

Example: ./haproxy.cfg

Example: ./PATH/haproxy.cfg

Example hidden file: ./PATH/.haproxy.cfg

  -v ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro 

Using absolute path:

Example: /haproxy.cfg

Example: /PATH/haproxy.cfg

Example hidden file: /PATH/.haproxy.cfg

Example: $PWD/haproxy.cfg

  -v /PATH/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!