hashicorp / hashicorp/consul-template

unable to find tcp host for catalog.services

Open
#1,300 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Go
Stars
4.8k
Forks
801
Avg merge
4h 5m
Merged PRs (30d)
6

Description

From the examples/nginx.md at https://github.com/hashicorp/consul-template/blob/master/examples/nginx.md using alpine version v0.22.0 (005b42eb)

I've given a custom host -consul-addr "consul:8500" but it's unable to reach

Screenshot: https://i.stack.imgur.com/1bQrb.png

### Configuration

```nginx.conf.ctmp
{{range services}} {{$name := .Name}} {{$service := service .Name}}
upstream {{$name}} {
zone upstream-{{$name}} 64k;
{{range $service}}server {{.Address}}:{{.Port}} max_fails=3 fail_timeout=60 weight=1;
{{else}}server 127.0.0.1:65535; # force a 502{{end}}
} {{end}}

server {
listen 80 default_server;

location / {
root /usr/share/nginx/html/;
index index.html;
}

location /stub_status {
stub_status;
}

{{range services}} {{$name := .Name}}
location /{{$name}} {
proxy_pass http://{{$name}};
}
{{end}}
}

```
## Dockerfile

```Dockerfile
FROM hashicorp/consul-template:alpine as template

COPY nginx.conf.ctmpl /tmp/nginx.conf.ctmpl

RUN consul-template -consul-addr "consul:8500" -template="/tmp/nginx.conf.ctmpl:/etc/nginx/conf.d/default.conf"

FROM nginx

COPY --from=template /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
```

## docker-compose

```docker-compose
version: '3'

services:

consul:
image: consul:1.6.1
container_name: consul
ports:
- 8300:8300
- 8400:8400
- 8500:8500

service:
container_name: service
build:
context: ./service
dockerfile: Dockerfile
ports:
- 8080:80
depends_on:
- consul

```

Contributor guide

Open the contributing guide

Research direction

Start with examples/nginx.md, then inspect the Dockerfile and docker-compose configuration shown in the issue. Reproduce the consul-template invocation using -consul-addr "consul:8500" and check why the template cannot reach the catalog.services endpoint. Done means the example works with the stated Compose setup or the required configuration change is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.