Closed devcoder18 closed 7 years ago
@devcoder18
dockercloud/haproxy
reads the environment variable from the "inspect" of the application services/containers. If you set it in them in Dockerfile, they cannot be read by dockercloud/haproxy
. This explains why it doesn't work.
You have to set the environment variable in the runtime.
I am specifying the environment variables for my swarm service in the Dockerfile used to build the original image. I do
docker service create
without -e command-line arguments (because they are already specified for the container when it's image was built). I checked the haproxy container logs but it is not picking up configurations forSERVICE_PORTS
,VIRTUAL_HOST
orEXTRA_SETTINGS
and requests are not proxied.