Adguard docker cannot access web ui - docker

im working on a raspberry pi and trying to setup adguard home with docker compose.
First inital setup all works fine. When i start the container i can access the webUI with "HOST:3000". But when I recreate the container the webUi is no more accessible. I found out that if i delete the "AdGuardHome.yaml" within the conf folder its working again until i finish the inital setup again.
My compose file:
version: "3"
adguard:
image: adguard/adguardhome:v0.108.0-b.25
container_name: adguard
restart: unless-stopped
ports:
- 53:53/tcp
- 53:53/udp
- 67:67/udp
- 69:68/udp
- 80:80/tcp
- 443:443/tcp
- 443:443/udp
- 3000:3000/tcp
- 853:853/tcp
- 784:784/udp
- 853:853/udp
- 8853:8853/udp
- 5443:5443/tcp
- 5443:5443/udp
environment:
- TZ=Europe/Berlin
volumes:
- /home/pi/homematicDocker/adguard/work:/opt/adguardhome/work
- /home/pi/homematicDocker/adguard/conf:/opt/adguardhome/conf
network_mode: host
The containers log:
2023/01/29 06:22:12.243914 [info] AdGuard Home, version v0.108.0-b.25
2023/01/29 06:22:12.244302 [info] AdGuard Home updates are disabled
2023/01/29 06:22:12.253579 [info] tls: using default ciphers
2023/01/29 06:22:12.292132 [info] Initializing auth module: /opt/adguardhome/work/data/sessions.db
2023/01/29 06:22:12.293924 [info] auth: initialized. users:1 sessions:1
2023/01/29 06:22:12.294066 [info] web: initializing
2023/01/29 06:22:12.439396 [info] dnsproxy: cache: enabled, size 4096 b
2023/01/29 06:22:12.439482 [info] MaxGoroutines is set to 300
2023/01/29 06:22:12.442166 [info] AdGuard Home is available at the following addresses:
2023/01/29 06:22:12.447718 [info] Go to http://127.0.0.1:80
2023/01/29 06:22:12.447818 [info] Go to http://[::1]:80
2023/01/29 06:22:12.447854 [info] Go to http://192.168.178.37:80
2023/01/29 06:22:12.447889 [info] Go to http://[2003:f2:670b:5400:fe5f:c7b3:47e9:2db0]:80
2023/01/29 06:22:12.447926 [info] Go to http://[fe80::fac1:92f4:4829:1a7a%eth0]:80
2023/01/29 06:22:12.447961 [info] Go to http://172.17.0.1:80
2023/01/29 06:22:12.447997 [info] Go to http://[fe80::42:aff:fe19:feba%docker0]:80
2023/01/29 06:22:12.448032 [info] Go to http://172.18.0.1:80
2023/01/29 06:22:12.448235 [info] Go to http://[fe80::42:2bff:fee7:ea90%br-83f36fdc3e1b]:80
2023/01/29 06:22:12.448285 [info] Go to http://172.19.0.1:80
2023/01/29 06:22:12.448414 [info] Go to http://[fe80::42:bfff:feef:d231%br-d48134c39c76]:80
2023/01/29 06:22:12.448457 [info] Go to http://[fe80::24b3:79ff:fef6:548a%veth6e52584]:80
2023/01/29 06:22:12.448581 [info] Go to http://[fe80::94bf:17ff:fe2c:62ed%veth6138d5a]:80
2023/01/29 06:22:12.448623 [info] Go to http://[fe80::4ca6:93ff:fe33:c5bb%veth4a0eccf]:80
2023/01/29 06:22:12.449176 [info] Go to http://[fe80::ed15:c73e:7dd0:b08e%veth919a0eb]:80
2023/01/29 06:22:12.449234 [info] Go to http://[fe80::ccb4:3c9e:5dc4:ed0%vethcedf116]:80
2023/01/29 06:22:13.626359 [info] Starting the DNS proxy server
2023/01/29 06:22:13.626421 [info] Ratelimit is enabled and set to 20 rps
2023/01/29 06:22:13.626444 [info] The server is configured to refuse ANY requests
2023/01/29 06:22:13.626526 [info] dnsproxy: cache: enabled, size 4194304 b
2023/01/29 06:22:13.626605 [info] MaxGoroutines is set to 300
2023/01/29 06:22:13.626708 [info] Creating the UDP server socket
2023/01/29 06:22:13.627076 [info] Listening to udp://[::]:53
2023/01/29 06:22:13.627115 [info] Creating a TCP server socket
2023/01/29 06:22:13.627356 [info] Listening to tcp://[::]:53
2023/01/29 06:22:13.627645 [info] Entering the UDP listener loop on [::]:53
2023/01/29 06:22:13.627645 [info] Entering the tcp listener loop on [::]:53

I was able to access the web ui by hostname without any port.
So i changed the port of the AdguardHome.yml to 3000. So its running as expected.

Related

Mlflow UI can't show artifacts

I have mlflow running on an azure VM and connected to Azure Blob as the artifact storage.
After uploading artifacts to the storage from the Client.
I tried the MLflow UI and successfully was able to show the uploaded file.
The problem happens when I try to run MLFLOW with Docker, I get the error:
Unable to list artifacts stored under {artifactUri} for the current run. Please contact your tracking server administrator to notify them of this error, which can happen when the tracking server lacks permission to list artifacts under the current run's root artifact directory
Dockerfile:
FROM python:3.7-slim-buster
# Install python packages
RUN pip install mlflow pymysql
RUN pip install azure-storage-blob
ENV AZURE_STORAGE_ACCESS_KEY="#########"
ENV AZURE_STORAGE_CONNECTION_STRING="#######"
docker-compose.yml
web:
restart: always
build: ./mlflow_server
image: mlflow_server
container_name: mlflow_server
expose:
- "5000"
networks:
- frontend
- backend
environment:
- AZURE_STORAGE_ACCESS_KEY="#####"
- AZURE_STORAGE_CONNECTION_STRING="#####"
command: mlflow server --backend-store-uri mysql+pymysql://mlflow_user:123456#db:3306/mlflow --default-artifact-root wasbs://etc..
I tried multiple solutions:
Making sure that boto3 is installed (Didn't do anything)
Adding Environment Variables in the Dockerfile so the command runs after they're set
I double checked the url of the storage blob
And MLFLOW doesn't show any logs it just kills the process and restarts again.
Anyone got any idea what might be the solution or how can i access the logs
here're the docker logs of the container:
[2022-07-28 12:23:33 +0000] [10] [INFO] Starting gunicorn 20.1.0
[2022-07-28 12:23:33 +0000] [10] [INFO] Listening at: http://0.0.0.0:5000 (10)
[2022-07-28 12:23:33 +0000] [10] [INFO] Using worker: sync
[2022-07-28 12:23:33 +0000] [13] [INFO] Booting worker with pid: 13
[2022-07-28 12:23:33 +0000] [14] [INFO] Booting worker with pid: 14
[2022-07-28 12:23:33 +0000] [15] [INFO] Booting worker with pid: 15
[2022-07-28 12:23:33 +0000] [16] [INFO] Booting worker with pid: 16
[2022-07-28 12:24:24 +0000] [10] [CRITICAL] WORKER TIMEOUT (pid:14)
[2022-07-28 12:24:24 +0000] [14] [INFO] Worker exiting (pid: 14)
[2022-07-28 12:24:24 +0000] [21] [INFO] Booting worker with pid: 21

Two rabbitmq isntances on one server with docker compose how to change the default port

I would like to run two instances of rabbitmq on one server. All I create with docker-compose. The thing is how I can change the default node and management ports. I have tried setting it via ports but it didn't help. When I was facing the same scenario but with mongo, I have used command: mongod --port CUSTOM_PORT . What would be the analogical command here for rabbitmq?
Here is my config for the second instance of rabbitmq.
version: '2'
services:
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: 'rabbitmq_test'
ports:
- 5673:5673
- 15673:15673
volumes:
- ./rabbitmq/data/:/var/lib/rabbitmq/
- ./rabbitmq/log/:/var/log/rabbitmq
networks:
- rabbitmq_go_net_test
environment:
RABBITMQ_DEFAULT_USER: 'test'
RABBITMQ_DEFAULT_PASS: 'test'
HOST_PORT_RABBIT: 5673
HOST_PORT_RABBIT_MGMT: 15673
networks:
rabbitmq_go_net_test:
driver: bridge
And the outcome is below
Management plugin: HTTP (non-TLS) listener started on port 15672
rabbitmq_test | 2021-03-18 11:32:42.553 [info] <0.738.0> Ready to start client connection listeners
rabbitmq_test | 2021-03-18 11:32:42.553 [info] <0.44.0> Application rabbitmq_prometheus started on node rabbit#fb24038613f3
rabbitmq_test | 2021-03-18 11:32:42.557 [info] <0.1035.0> started TCP listener on [::]:5672
We can see that there are still ports 5672 and 15672 exposed instead of 5673 and 15673.
EDIT
ports:
- 5673:5672
- 15673:15672
I have tried that the above conf yet with no success
rabbitmq_test | 2021-03-18 14:08:56.167 [info] <0.797.0> Management plugin: HTTP (non-TLS) listener started on port 15672
rabbitmq_test | 2021-03-18 14:08:56.167 [info] <0.903.0> Statistics database started.
rabbitmq_test | 2021-03-18 14:08:56.167 [info] <0.902.0> Starting worker pool 'management_worker_pool' with 3 processes in it
rabbitmq_test | 2021-03-18 14:08:56.168 [info] <0.44.0> Application rabbitmq_management started on node rabbit#9358e6f4d2a5
rabbitmq_test | 2021-03-18 14:08:56.208 [info] <0.44.0> Application prometheus started on node rabbit#9358e6f4d2a5
rabbitmq_test | 2021-03-18 14:08:56.213 [info] <0.916.0> Prometheus metrics: HTTP (non-TLS) listener started on port 15692
rabbitmq_test | 2021-03-18 14:08:56.213 [info] <0.44.0> Application rabbitmq_prometheus started on node rabbit#9358e6f4d2a5
rabbitmq_test | 2021-03-18 14:08:56.213 [info] <0.738.0> Ready to start client connection listeners
rabbitmq_test | 2021-03-18 14:08:56.216 [info] <0.1035.0> started TCP listener on [::]:5672
I have found the solution. I provided the configuration file to the rabbitmq container.
loopback_users.guest = false
listeners.tcp.default = 5673
default_pass = test
default_user = test
management.tcp.port = 15673
And a working docker-compose file
version: '2'
services:
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: 'rabbitmq_test'
ports:
- 5673:5673
- 15673:15673
volumes:
- ./rabbitmq/data/:/var/lib/rabbitmq/
- ./rabbitmq/log/:/var/log/rabbitmq
- ./conf/myrabbit.conf:/etc/rabbitmq/rabbitmq.conf
networks:
- rabbitmq_go_net_test
networks:
rabbitmq_go_net_test:
driver: bridge
A working example with rabbitmq:3.9.13-management-alpine
docker/rabbitmq/rabbitmq.conf:
loopback_users.guest = false
listeners.tcp.default = 5673
default_pass = guest
default_user = guest
default_vhost = /
docker/rabbitmq/Dockerfile:
FROM rabbitmq:3.9.13-management-alpine
COPY --chown=rabbitmq:rabbitmq rabbitmq.conf /etc/rabbitmq/rabbitmq.conf
EXPOSE 4369 5671 5672 5673 15691 15692 25672 25673
docker-compose.yml:
...
rabbitmq:
#image: "rabbitmq:3-management-alpine"
build: './docker/rabbitmq/'
container_name: my-rabbitmq
environment:
RABBITMQ_DEFAULT_VHOST: /
ports:
- 5673:5672
- 15673:15672
networks:
- default
...

why won't the gunicorn worker boot when running in Docker?

UPDATED SHORT VERSION: if I have a docker image that fails to run (but leaves very little detail as to why), is there a way to connect to the container running the image to debug it?
(Many thanks to those who pointed out the issue with multiple CMD entries in the Dockerfile. I'm still trying to wrap my head around that)
SHORT VERSION: I can't bring up my web service with "docker run" because "Worker failed to boot." How can I find out what is failing?
LONG VERSION:
I can run my Django project with gunicorn in the foreground:
(trans3) chris#chi:~/website$ gunicorn --bind 0.0.0.0:8000 hero.wsgi
[2018-07-02 15:18:36 +0000] [21541] [INFO] Starting gunicorn 19.7.1
[2018-07-02 15:18:36 +0000] [21541] [INFO] Listening at: http://0.0.0.0:8000 (21541)
[2018-07-02 15:18:36 +0000] [21541] [INFO] Using worker: sync
[2018-07-02 15:18:36 +0000] [21546] [INFO] Booting worker with pid: 21546
^C
[2018-07-02 15:18:39 +0000] [21541] [INFO] Handling signal: int
[2018-07-02 15:18:39 +0000] [21541] [INFO] Shutting down: Master
I have a small Dockerfile.web for my service:
(trans3) chris#chi:~/website$ cat Dockerfile.web
# start with our Django app image
FROM dockersite:latest
# collectstatic.
CMD python manage.py collectstatic --noinput
# run the server
CMD gunicorn --bind 0.0.0.0:$PORT hero.wsgi
I build my image
(trans3) chris#chi:~/website$ docker build -t dockersite/web -f Dockerfile.web .
Sending build context to Docker daemon 137.5MB
Step 1/3 : FROM dockersite:latest
---> 56b1488f8e27
Step 2/3 : CMD python manage.py collectstatic --noinput
---> Using cache
---> 59585027568d
Step 3/3 : CMD gunicorn --bind 0.0.0.0:$PORT hero.wsgi
---> Using cache
---> c17429800329
Successfully built c17429800329
Successfully tagged dockersite/web:latest
I try to run my image:
(trans3) chris#chi:~/website$ docker run -e PORT=8000 -p 8000:8000 --env-file=.env dockersite/web:latest
[2018-07-02 19:23:26 +0000] [8] [INFO] Starting gunicorn 19.7.1
[2018-07-02 19:23:26 +0000] [8] [INFO] Listening at: http://0.0.0.0:8000 (8)
[2018-07-02 19:23:26 +0000] [8] [INFO] Using worker: sync
[2018-07-02 19:23:26 +0000] [12] [INFO] Booting worker with pid: 12
MEMCACHEDCLOUD_SERVERS not found, using LocMem cache
[2018-07-02 19:23:27 +0000] [8] [INFO] Shutting down: Master
[2018-07-02 19:23:27 +0000] [8] [INFO] Reason: Worker failed to boot.
How can I get more information out of Gunicorn to tell me why it's failing? Is there a logger in Python that I can adjust? (I tried --spew and got lots of information, none of it useful.)
Sometimes docker & Github & gunicorn together fails, so try switching branches and switching back to see if it makes a difference.
You may have a python error that the logs for which disappear and gunicorn refuses to show you your python errors.
Use this in your launch for gunicorn in your docker file:
CMD ["gunicorn", "--preload"]

Connect consul agent to consul

I'm trying to setup the consul server and connect an agent to it for 2 or 3 days already. I'm using docker-compose.
But after performing a join operation, agent gets a message "Agent not live or unreachable".
Here are the logs:
root#e33a6127103f:/app# consul agent -join 10.1.30.91 -data-dir=/tmp/consul
==> Starting Consul agent...
==> Joining cluster...
Join completed. Synced with 1 initial agents
==> Consul agent running!
Version: 'v1.0.1'
Node ID: '0e1adf74-462d-45a4-1927-95ed123f1526'
Node name: 'e33a6127103f'
Datacenter: 'dc1' (Segment: '')
Server: false (Bootstrap: false)
Client Addr: [127.0.0.1] (HTTP: 8500, HTTPS: -1, DNS: 8600)
Cluster Addr: 172.17.0.2 (LAN: 8301, WAN: 8302)
Encrypt: Gossip: false, TLS-Outgoing: false, TLS-Incoming: false
==> Log data will now stream in as it occurs:
2017/12/06 10:44:43 [INFO] serf: EventMemberJoin: e33a6127103f 172.17.0.2
2017/12/06 10:44:43 [INFO] agent: Started DNS server 127.0.0.1:8600 (udp)
2017/12/06 10:44:43 [INFO] agent: Started DNS server 127.0.0.1:8600 (tcp)
2017/12/06 10:44:43 [INFO] agent: Started HTTP server on 127.0.0.1:8500 (tcp)
2017/12/06 10:44:43 [INFO] agent: (LAN) joining: [10.1.30.91]
2017/12/06 10:44:43 [INFO] serf: EventMemberJoin: consul1 172.19.0.2 2017/12/06 10:44:43 [INFO] consul: adding server consul1 (Addr: tcp/172.19.0.2:8300) (DC: dc1)
2017/12/06 10:44:43 [INFO] agent: (LAN) joined: 1 Err: <nil>
2017/12/06 10:44:43 [INFO] agent: started state syncer
2017/12/06 10:44:43 [WARN] manager: No servers available
2017/12/06 10:44:43 [ERR] agent: failed to sync remote state: No known Consul servers
2017/12/06 10:44:54 [INFO] memberlist: Suspect consul1 has failed, no acks received
2017/12/06 10:44:55 [ERR] consul: "Catalog.NodeServices" RPC failed to server 172.19.0.2:8300: rpc error getting client: failed to get conn: dial tcp <nil>->172.19.0.2:8300: i/o timeout
2017/12/06 10:44:55 [ERR] agent: failed to sync remote state: rpc error getting client: failed to get conn: dial tcp <nil>->172.19.0.2:8300: i/o timeout
2017/12/06 10:44:58 [INFO] memberlist: Marking consul1 as failed, suspect timeout reached (0 peer confirmations)
2017/12/06 10:44:58 [INFO] serf: EventMemberFailed: consul1 172.19.0.2
2017/12/06 10:44:58 [INFO] consul: removing server consul1 (Addr: tcp/172.19.0.2:8300) (DC: dc1)
2017/12/06 10:45:05 [INFO] memberlist: Suspect consul1 has failed, no acks received
2017/12/06 10:45:06 [WARN] manager: No servers available
2017/12/06 10:45:06 [ERR] agent: Coordinate update error: No known Consul servers
2017/12/06 10:45:12 [WARN] manager: No servers available
2017/12/06 10:45:12 [ERR] agent: failed to sync remote state: No known Consul servers
2017/12/06 10:45:13 [INFO] serf: attempting reconnect to consul1 172.19.0.2:8301
2017/12/06 10:45:28 [WARN] manager: No servers available
2017/12/06 10:45:28 [ERR] agent: failed to sync remote state: No known Consul servers
2017/12/06 10:45:32 [WARN] manager: No servers available . `
My settings are:
docker-compose SERVER:
consul1:
image: "consul.1.0.1"
container_name: "consul1"
hostname: "consul1"
volumes:
- ./consul/config:/config/
ports:
- "8400:8400"
- "8500:8500"
- "8600:53"
- "8300:8300"
- "8301:8301"
command: "agent -config-dir=/config -ui -server -bootstrap-expect 1"
Help please solve the problem.
I think you using wrong ip-address of consul-server
"consul agent -join 10.1.30.91 -data-dir=/tmp/consul"
10.1.30.91 this is not docker container ip it might be your host address/virtualbox.
Get consul-container ip and use that to join in consul-agent command.
For more info about how consul and agent works follow the link
https://dzone.com/articles/service-discovery-with-docker-and-consul-part-1
Try to get the right IP address by executing this command:
docker inspect <container id> | grep "IPAddress"
Where the is the container ID of the consul server.
Than use the obtained address instead of "10.1.30.91" in the command
consul agent -join <IP ADDRESS CONSUL SERVER> -data-dir=/tmp/consul

Consul Empty reply from server

I'm trying to get a consul server cluster up and running. I have 3 dockerized consul servers running, but I can't access the Web UI, the HTTP API nor the DNS.
$ docker logs net-sci_discovery-service_consul_1
==> WARNING: Expect Mode enabled, expecting 3 servers
==> Starting Consul agent...
==> Consul agent running!
Version: 'v0.8.5'
Node ID: 'ccd38897-6047-f8b6-be1c-2aa0022a1483'
Node name: 'consul1'
Datacenter: 'dc1'
Server: true (bootstrap: false)
Client Addr: 127.0.0.1 (HTTP: 8500, HTTPS: -1, DNS: 8600)
Cluster Addr: 172.20.0.2 (LAN: 8301, WAN: 8302)
Gossip encrypt: false, RPC-TLS: false, TLS-Incoming: false
==> Log data will now stream in as it occurs:
2017/07/07 23:24:07 [INFO] raft: Initial configuration (index=0): []
2017/07/07 23:24:07 [INFO] raft: Node at 172.20.0.2:8300 [Follower] entering Follower state (Leader: "")
2017/07/07 23:24:07 [INFO] serf: EventMemberJoin: consul1 172.20.0.2
2017/07/07 23:24:07 [INFO] consul: Adding LAN server consul1 (Addr: tcp/172.20.0.2:8300) (DC: dc1)
2017/07/07 23:24:07 [INFO] serf: EventMemberJoin: consul1.dc1 172.20.0.2
2017/07/07 23:24:07 [INFO] consul: Handled member-join event for server "consul1.dc1" in area "wan"
2017/07/07 23:24:07 [INFO] agent: Started DNS server 127.0.0.1:8600 (tcp)
2017/07/07 23:24:07 [INFO] agent: Started DNS server 127.0.0.1:8600 (udp)
2017/07/07 23:24:07 [INFO] agent: Started HTTP server on 127.0.0.1:8500
2017/07/07 23:24:09 [INFO] serf: EventMemberJoin: consul2 172.20.0.3
2017/07/07 23:24:09 [INFO] consul: Adding LAN server consul2 (Addr: tcp/172.20.0.3:8300) (DC: dc1)
2017/07/07 23:24:09 [INFO] serf: EventMemberJoin: consul2.dc1 172.20.0.3
2017/07/07 23:24:09 [INFO] consul: Handled member-join event for server "consul2.dc1" in area "wan"
2017/07/07 23:24:10 [INFO] serf: EventMemberJoin: consul3 172.20.0.4
2017/07/07 23:24:10 [INFO] consul: Adding LAN server consul3 (Addr: tcp/172.20.0.4:8300) (DC: dc1)
2017/07/07 23:24:10 [INFO] consul: Found expected number of peers, attempting bootstrap: 172.20.0.2:8300,172.20.0.3:8300,172.20.0.4:8300
2017/07/07 23:24:10 [INFO] serf: EventMemberJoin: consul3.dc1 172.20.0.4
2017/07/07 23:24:10 [INFO] consul: Handled member-join event for server "consul3.dc1" in area "wan"
2017/07/07 23:24:14 [ERR] agent: failed to sync remote state: No cluster leader
2017/07/07 23:24:17 [WARN] raft: Heartbeat timeout from "" reached, starting election
2017/07/07 23:24:17 [INFO] raft: Node at 172.20.0.2:8300 [Candidate] entering Candidate state in term 2
2017/07/07 23:24:17 [INFO] raft: Election won. Tally: 2
2017/07/07 23:24:17 [INFO] raft: Node at 172.20.0.2:8300 [Leader] entering Leader state
2017/07/07 23:24:17 [INFO] raft: Added peer 172.20.0.3:8300, starting replication
2017/07/07 23:24:17 [INFO] raft: Added peer 172.20.0.4:8300, starting replication
2017/07/07 23:24:17 [INFO] consul: cluster leadership acquired
2017/07/07 23:24:17 [INFO] consul: New leader elected: consul1
2017/07/07 23:24:17 [WARN] raft: AppendEntries to {Voter 172.20.0.3:8300 172.20.0.3:8300} rejected, sending older logs (next: 1)
2017/07/07 23:24:17 [WARN] raft: AppendEntries to {Voter 172.20.0.4:8300 172.20.0.4:8300} rejected, sending older logs (next: 1)
2017/07/07 23:24:17 [INFO] raft: pipelining replication to peer {Voter 172.20.0.3:8300 172.20.0.3:8300}
2017/07/07 23:24:17 [INFO] raft: pipelining replication to peer {Voter 172.20.0.4:8300 172.20.0.4:8300}
2017/07/07 23:24:18 [INFO] consul: member 'consul1' joined, marking health alive
2017/07/07 23:24:18 [INFO] consul: member 'consul2' joined, marking health alive
2017/07/07 23:24:18 [INFO] consul: member 'consul3' joined, marking health alive
2017/07/07 23:24:20 [INFO] agent: Synced service 'consul'
2017/07/07 23:24:20 [INFO] agent: Synced service 'messaging-service-kafka'
2017/07/07 23:24:20 [INFO] agent: Synced service 'messaging-service-zookeeper'
$ curl http://127.0.0.1:8500/v1/catalog/service/consul
curl: (52) Empty reply from server
dig #127.0.0.1 -p 8600 consul.service.consul
; <<>> DiG 9.8.3-P1 <<>> #127.0.0.1 -p 8600 consul.service.consul
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
$ dig #127.0.0.1 -p 8600 messaging-service-kafka.service.consul
; <<>> DiG 9.8.3-P1 <<>> #127.0.0.1 -p 8600 messaging-service-kafka.service.consul
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
I can't get my services to register via the HTTP API either; those shown above are registered using a config script when the container launches.
Here's my docker-compose.yml:
version: '2'
services:
consul1:
image: "consul:latest"
container_name: "net-sci_discovery-service_consul_1"
hostname: "consul1"
ports:
- "8400:8400"
- "8500:8500"
- "8600:8600"
volumes:
- ./etc/consul.d:/etc/consul.d
command: "agent -server -ui -bootstrap-expect 3 -config-dir=/etc/consul.d -bind=0.0.0.0"
consul2:
image: "consul:latest"
container_name: "net-sci_discovery-service_consul_2"
hostname: "consul2"
command: "agent -server -join=consul1"
links:
- "consul1"
consul3:
image: "consul:latest"
container_name: "net-sci_discovery-service_consul_3"
hostname: "consul3"
command: "agent -server -join=consul1"
links:
- "consul1"
I'm relatively new to both docker and consul. I've had a look around the web and the above options are my understanding of what is required. Any suggestions on the way forward would be very welcome.
Edit:
Result of docker container ps -all:
$ docker container ps --all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e0a1c3bba165 consul:latest "docker-entrypoint..." 38 seconds ago Up 36 seconds 8300-8302/tcp, 8500/tcp, 8301-8302/udp, 8600/tcp, 8600/udp net-sci_discovery-service_consul_3
7f05555e81e0 consul:latest "docker-entrypoint..." 38 seconds ago Up 36 seconds 8300-8302/tcp, 8500/tcp, 8301-8302/udp, 8600/tcp, 8600/udp net-sci_discovery-service_consul_2
9e2dedaa224b consul:latest "docker-entrypoint..." 39 seconds ago Up 38 seconds 0.0.0.0:8400->8400/tcp, 8301-8302/udp, 0.0.0.0:8500->8500/tcp, 8300-8302/tcp, 8600/udp, 0.0.0.0:8600->8600/tcp net-sci_discovery-service_consul_1
27b34c5dacb7 messagingservice_kafka "start-kafka.sh" 3 hours ago Up 3 hours 0.0.0.0:9092->9092/tcp net-sci_messaging-service_kafka
0389797b0b8f wurstmeister/zookeeper "/bin/sh -c '/usr/..." 3 hours ago Up 3 hours 22/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp net-sci_messaging-service_zookeeper
Edit:
Updated docker-compose.yml to include long format for ports:
version: '3.2'
services:
consul1:
image: "consul:latest"
container_name: "net-sci_discovery-service_consul_1"
hostname: "consul1"
ports:
- target: 8400
published: 8400
mode: host
- target: 8500
published: 8500
mode: host
- target: 8600
published: 8600
mode: host
volumes:
- ./etc/consul.d:/etc/consul.d
command: "agent -server -ui -bootstrap-expect 3 -config-dir=/etc/consul.d -bind=0.0.0.0 -client=127.0.0.1"
consul2:
image: "consul:latest"
container_name: "net-sci_discovery-service_consul_2"
hostname: "consul2"
command: "agent -server -join=consul1"
links:
- "consul1"
consul3:
image: "consul:latest"
container_name: "net-sci_discovery-service_consul_3"
hostname: "consul3"
command: "agent -server -join=consul1"
links:
- "consul1"
From the Consul Web Gui page, make sure you have launched an agent with the -ui parameter.
The UI is available at the /ui path on the same port as the HTTP API.
By default this is http://localhost:8500/ui
I do see 8500 mapped to your host on broadcast (0.0.0.0).
Check also (as in this answer) if the client_addr can help (at least for testing)

Resources