I’m using the following docker compose file to build my docker swarm stack that have windows containers deployed in a Windows 10:
version: '3.2' services: service1: image: myrepository/dotnet-framework:3.5-windowsservercore environment: - my_path="C:/app/build/app.exe" - my_arg= 1 deploy: replicas: 1 placement: constraints: - node.id == asdfasdgasgasg volumes: - service1:C:/app service1: image: myrepository/dotnet-framework:3.5-windowsservercore ports: - target: 7878 published: 7878 mode: host environment: - my_path="C:/app/app.exe" - my_arg= 2 deploy: replicas: 1 placement: constraints: - node.id == asdfasdgasgasg volumes: - service1:C:/app volumes: service2: external: name: service1 service1: external: name: service1
As you can see
service2 is listening in port
7878 . I know, as is shown in this post, that I can’t reach this port using
localhost:7878 . Thus I run the command
docker inspect containerID to figure out the IP address of the container.
If I ping the container
service1 , it responds. But If I try to access the port
10.0.3.18:7878 from the host, there’s no response. How could I reach port 7878 from the hots? On the other hand, I have Linux containers that must reach the ‘service2’ windows container.