Can you share that error message?
and alos how you installed Docker. The output of the following commands can help us understand:
docker info
docker version
dpkg -l | grep docker
snap list docker
If the IP address works, then the problem could be Docker’s built-in DNS server which usually works well when Docker installed from the official epository.
Viewing logs from inside the wallet-core container shows error:
> wallet-app-node@1.0.0 start
> ts-node --esm src/index.ts
Server running on http://localhost:3001
JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)
... JsonRpcProvider retries connection and error repeats indefinitely ...
I should note that I’ve also tried:
using custom network (bridged)
stopping the wallet-app-core service and then restarting it after making absolute certain node1 service is running
I believe I installed docker by downloading the repository and installing using apt.
$docker version
Client: Docker Engine - Community
Version: 24.0.7
API version: 1.43
Go version: go1.20.10
Git commit: afdd53b
Built: Thu Oct 26 09:07:41 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.7
API version: 1.43 (minimum version 1.12)
Go version: go1.20.10
Git commit: 311b9ff
Built: Thu Oct 26 09:07:41 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.24
GitCommit: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
runc:
Version: 1.1.9
GitCommit: v1.1.9-0-gccaecfc
docker-init:
Version: 0.19.0
GitCommit: de40ad0
$dpkg -l | grep docker
ii docker-buildx-plugin 0.11.2-1~ubuntu.22.04~jammy amd64 Docker Buildx cli plugin.
ii docker-ce 5:24.0.7-1~ubuntu.22.04~jammy amd64 Docker: the open-source application container engine
ii docker-ce-cli 5:24.0.7-1~ubuntu.22.04~jammy amd64 Docker CLI: the open-source application container engine
ii docker-ce-rootless-extras 5:24.0.7-1~ubuntu.22.04~jammy amd64 Rootless support for Docker.
ii docker-compose 1.29.2-1 all define and run multi-container Docker applications with YAML
ii docker-compose-plugin 2.21.0-1~ubuntu.22.04~jammy amd64 Docker Compose (V2) plugin for the Docker CLI.
ii docker-scan-plugin 0.23.0~ubuntu-jammy amd64 Docker scan cli plugin.
ii python3-docker 5.0.3-1 all Python 3 wrapper to access docker.io's control socket
ii python3-dockerpty 0.4.1-2 all Pseudo-tty handler for docker Python client (Python 3.x)
$snap list docker
error: no matching snaps installed
And yes, changing environment variable to IP address of node1 service works normally.
Have you tried to nslookup from a container to see if that resolves the domain name to the correct IP address?
You could also try to run another container in the compose project thta runs an nginx or httpd szerver and use curl from another container to access the webserver using its container name.
As long as you use a user defined network, service discovery should work.
You nslookup output shows that the built-in dns with the ip 127.0.0.11 is used. This is correct.
Furthermore, the ip for the node1 should be the target container.
Your output indicates that name resolution itself is not the problem, otherwise it would not be able to reach the application in the target container. In case of nginx, it looks like there is no listener for that hostname.
Another issue could be dns caching: depending on the programming language and implementation, resolved hostnames could be cached, in some cases even indefinitely, which would then indeed use an outdated container ip, if the target container was restarted and received a new ip.