Access TCP Server on docker container from host or other machines/hardware devices

Hi All - I have a TCP server written in .NET that runs in a Docker container. The container is assigned the IP address 10.0.0.100, and the TCP server is running on port 8084 (e.g., 10.0.0.100:8087). A test TCP client running in another Docker container successfully connects to this server. Everything is working as expected so far.

However, I have an external client (which could be hardware connected to the network) that needs to connect to this server. To achieve this, I tried to ping 10.0.0.100 or telnet from host machine first, but it is not reachable. Ideally, the hardware/another machine with a TCP client having an IP, eg 10.0.0.60 from the same subnet (10.0.0.0/24) which is connected to the networkcard will have to establish the connectivity to this TCP Server. I have seen several posts related to this issue but could not find a proper solution.

Here is my docker-compose file. It would be great if anyone can help me on this.

services:
testtcpserver:
image: ${DOCKER_REGISTRY-}testtcpserver
networks:
network-default:
custom-network:
ipv4_address: 10.0.0.100
environment:
- tcpserveripaddress=10.0.0.100
- tcpserverport=8087
ports:
- “8087:8087”
build:
context: .
dockerfile: testtcpserver/Dockerfile
networks:
network-default:
name: network-default
driver: bridge
custom-network:
name: custom-network
driver: bridge
ipam:
config:
- subnet: 10.0.0.0/24
gateway: 10.0.0.1

Server status
docker-compose up testtcpserver
[+] Running 1/0
:heavy_check_mark: Container testtcpserver-testtcpserver-1 Created 0.0s
Attaching to testtcpserver-1
testtcpserver-1 | Server listening on port 8087…

Run telnet from host machine :
telnet 10.0.0.100 8087
Connecting To 10.0.0.100…Could not open connection to the host, on port 8087: Connect failed

docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b7731810165a testtcpserver “dotnet testtcpserve…” 7 minutes ago Up About a minute 0.0.0.0:8087->8087/tcp testtcpserver-testtcpserver-1

ping 10.0.0.100

Pinging 10.0.0.100 with 32 bytes of data:
Request timed out.
Request timed out.

This issue is resolved. The remote machine who runs the TCP client can successfully connect to the TCP Server if the TCP Client on remote is setup to connect to the IP of of the host machine where the docker runs(There must be an network card configured on the host machine in the same subnet). It seems the docker is doing the magic of ‘bridge’ to take the request from the host to the docker container.