mogoli
mogoli

Reputation: 2395

Cant access consul webui docker compose

Im trying to standup consul dev webui for traning purposes using docker compose.

While consul claims to be running, when I try to visit localhost:8500/ui, the site is unreachable.

My docker compose file:

version: "3"
services:

  cs1:
    image: consul:1.4.2
    ports:
      - "8500:8500"
    command: "agent -dev -ui"

The response from the console is

cs1_1_6d8d914aa536 | ==> Starting Consul agent...
cs1_1_6d8d914aa536 | ==> Consul agent running!
cs1_1_6d8d914aa536 |            Version: 'v1.4.2'
cs1_1_6d8d914aa536 |            Node ID: 'dfc6a0ce-3abc-a96d-718b-8b77155a2de6'
cs1_1_6d8d914aa536 |          Node name: '1fde0528ab0c'
cs1_1_6d8d914aa536 |         Datacenter: 'dc1' (Segment: '<all>')
cs1_1_6d8d914aa536 |             Server: true (Bootstrap: false)
cs1_1_6d8d914aa536 |        Client Addr: [127.0.0.1] (HTTP: 8500, HTTPS: -1, gRPC: 8502, DNS: 8600)
cs1_1_6d8d914aa536 |       Cluster Addr: 127.0.0.1 (LAN: 8301, WAN: 8302)
cs1_1_6d8d914aa536 |            Encrypt: Gossip: false, TLS-Outgoing: false, TLS-Incoming: false

I suspect the site is running on the docker container locahost but port 8500 hasnt been exposed properly.

Thanks for your help

Upvotes: 0

Views: 3443

Answers (2)

ozlevka
ozlevka

Reputation: 2156

By default, the consul is bind to localhost

Client Addr: [127.0.0.1] (HTTP: 8500, HTTPS: -1, gRPC: 8502, DNS: 8600)

add bind to your command usually allowed to any IP (0.0.0.0)

agent -dev -ui -bind=0.0.0.0

Upvotes: 0

Steve Boyd
Steve Boyd

Reputation: 1357

Remove the line command: "agent -dev -ui" from your docker-compose.yml.

The default command is already running the dev agent, see the Dockerfile here:

https://github.com/hashicorp/docker-consul/blob/9bd2aa7ecf2414b8712e055f2374699148e8941c/0.X/Dockerfile

Upvotes: 3

Related Questions