docker-library / haproxy

Docker Official Image packaging for HAProxy
http://www.haproxy.org/
GNU General Public License v2.0
351 stars 161 forks source link

Cannot open configuration file /usr/local/etc/haproxy/haproxy.cfg: No such file or directory #193

Closed rvendo closed 2 years ago

rvendo commented 2 years ago

I have been trying to set up haproxy to run through a docker container for three days now and keep facing the error in the title. I saw that there was another instance of this on this forum but that was solved by simply switching user to usr. This is not the case here.

My dockerfile contains:

FROM haproxy:2.3 COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg

When I run the syntax check command listed on HAProxy's Dockerhub, it states that it cannot find the config file and I am unsure as to what is causing this. Any ideas?

tianon commented 2 years ago

The image doesn't include a config file at all -- does your Dockerfile have a file named haproxy.cfg next to it with valid HAProxy configuration in it? :sweat_smile:

rvendo commented 2 years ago

The image doesn't include a config file at all -- does your Dockerfile have a file named haproxy.cfg next to it with valid HAProxy configuration in it? 😅

Yes, sorry figured I left out some valid information. There is a config file next to it that is validated by running "haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg".

TimWolla commented 2 years ago

Any ideas?

The error message from the title has local and etc switched compared to what's in your Dockerfile.

dgageot commented 2 years ago

@tianon @rvendo I think the problem comes from the fact that the documentation on the hub says this default config file exists. I think we should either put it back where it used to be or fix the doc. I stumbled on the same issue today.

yosifkit commented 2 years ago

I think the problem comes from the fact that the documentation on the hub says this default config file exists. I think we should either put it back where it used to be or fix the doc. I stumbled on the same issue today.

@dgageot What part of the Docker Hub documentation are you referring to? The first line of the "How to use this image" section says that it doesn't have any configuration included:

Since no two users of HAProxy are likely to configure it exactly alike, this image does not come with any default configuration.

- https://github.com/docker-library/docs/tree/1d49b1febaa8b6c6593cad216bc85cc6bcfb941b/haproxy#how-to-use-this-image

dgageot commented 2 years ago

@dgageot What part of the Docker Hub documentation are you referring to? The first line of the "How to use this image" section says that it doesn't have any configuration included:

Sorry, I mis-read the documentation. You can forget about my comment. When I saw the Test the configuration file section, I thought it was the default configuration file.